diff options
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 |