]> git.pld-linux.org Git - packages/file.git/commitdiff
stdin is not opened in this lib so don't close it!
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 3 Sep 2005 16:26:46 +0000 (16:26 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    file-stdin-noclose.patch -> 1.1

file-stdin-noclose.patch [new file with mode: 0644]

diff --git a/file-stdin-noclose.patch b/file-stdin-noclose.patch
new file mode 100644 (file)
index 0000000..9f84c24
--- /dev/null
@@ -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) {
This page took 0.127995 seconds and 4 git commands to generate.