From: Arkadiusz Miƛkiewicz Date: Sat, 3 Sep 2005 16:26:46 +0000 (+0000) Subject: stdin is not opened in this lib so don't close it! X-Git-Tag: auto/ac/file-4_15-2~1 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=e2a69670c5c34b2d1cae3e88c11151116a695561;p=packages%2Ffile.git stdin is not opened in this lib so don't close it! Changed files: file-stdin-noclose.patch -> 1.1 --- diff --git a/file-stdin-noclose.patch b/file-stdin-noclose.patch new file mode 100644 index 0000000..9f84c24 --- /dev/null +++ b/file-stdin-noclose.patch @@ -0,0 +1,34 @@ +diff -urN file-4.15.org/src/magic.c file-4.15/src/magic.c +--- file-4.15.org/src/magic.c 2005-06-30 18:33:01.000000000 +0200 ++++ file-4.15/src/magic.c 2005-09-03 18:21:15.038649200 +0200 +@@ -62,6 +62,10 @@ + + #include "patchlevel.h" + ++#ifndef STDIN_FILENO ++#define STDIN_FILENO 0 ++#endif ++ + #ifndef lint + FILE_RCSID("@(#)$Id$") + #endif /* lint */ +@@ -179,7 +183,8 @@ + close_and_restore(const struct magic_set *ms, const char *name, int fd, + const struct stat *sb) + { +- (void) close(fd); ++ if (fd != STDIN_FILENO) ++ close(fd); + if (fd != STDIN_FILENO && (ms->flags & MAGIC_PRESERVE_ATIME) != 0) { + /* + * Try to restore access, modification times if read it. +@@ -237,9 +242,6 @@ + goto done; + } + +-#ifndef STDIN_FILENO +-#define STDIN_FILENO 0 +-#endif + if (inname == NULL) + fd = STDIN_FILENO; + else if ((fd = open(inname, O_RDONLY)) < 0) {