diff options
author | Karl Berry <karl@freefriends.org> | 2022-02-13 22:53:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-02-13 22:53:37 +0000 |
commit | dcc4410cdc8ee138a9451a5b25e3904fed124f4b (patch) | |
tree | a3dfcd86f5bcac3816f5bcfc98258e8d7eec2e66 /Build/source/texk/xdvik/util.c | |
parent | c82d3595a7ed2e8afc2a67092d9acce9987e7dd8 (diff) |
cleaner fix for Mac reload problem (aka fseek error), from Paul V
git-svn-id: svn://tug.org/texlive/trunk@62013 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvik/util.c')
-rw-r--r-- | Build/source/texk/xdvik/util.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Build/source/texk/xdvik/util.c b/Build/source/texk/xdvik/util.c index 958a99c4788..7a7bd687786 100644 --- a/Build/source/texk/xdvik/util.c +++ b/Build/source/texk/xdvik/util.c @@ -1,6 +1,6 @@ /*========================================================================*\ -Copyright (c) 1990-2015 Paul Vojta and others +Copyright (c) 1990-2022 Paul Vojta and others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -281,6 +281,20 @@ try_open_mode(const char *fname, int flags, mode_t mode) return fd; } +/* + * Like try_fopen(), for dup(). + */ +int +try_dup(int oldfd) +{ + int fd = dup(oldfd); + if (fd < 0 && (errno == EMFILE || errno == ENFILE)) { + close_a_file(); + fd = dup(oldfd); + } + return fd; +} + /* * invoked on SIGSEGV: try to stop gs before aborting, to prevent gs |