SOURCES: file-stdin-noclose.patch (NEW) stdin is not opened in thi...
arekm
arekm at pld-linux.org
Sat Sep 3 18:26:51 CEST 2005
Author: arekm Date: Sat Sep 3 16:26:51 2005 GMT
Module: SOURCES Tag: HEAD
---- Log message:
stdin is not opened in this lib so don't close it!
---- Files affected:
SOURCES:
file-stdin-noclose.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/file-stdin-noclose.patch
diff -u /dev/null SOURCES/file-stdin-noclose.patch:1.1
--- /dev/null Sat Sep 3 18:26:51 2005
+++ SOURCES/file-stdin-noclose.patch Sat Sep 3 18:26:46 2005
@@ -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) {
================================================================
More information about the pld-cvs-commit
mailing list