]> git.pld-linux.org Git - packages/file.git/blob - file-stdin-noclose.patch
- updated for 4.16
[packages/file.git] / file-stdin-noclose.patch
1 diff -urN file-4.15.org/src/magic.c file-4.15/src/magic.c
2 --- file-4.15.org/src/magic.c   2005-06-30 18:33:01.000000000 +0200
3 +++ file-4.15/src/magic.c       2005-09-03 18:21:15.038649200 +0200
4 @@ -62,6 +62,10 @@
5  
6  #include "patchlevel.h"
7  
8 +#ifndef STDIN_FILENO
9 +#define STDIN_FILENO    0
10 +#endif
11 +
12  #ifndef        lint
13  FILE_RCSID("@(#)$Id$")
14  #endif /* lint */
15 @@ -179,7 +183,8 @@
16  close_and_restore(const struct magic_set *ms, const char *name, int fd,
17      const struct stat *sb)
18  {
19 -       (void) close(fd);
20 +       if (fd != STDIN_FILENO)
21 +               close(fd);
22         if (fd != STDIN_FILENO && (ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
23                 /*
24                  * Try to restore access, modification times if read it.
25 @@ -237,9 +242,6 @@
26                 goto done;
27         }
28  
29 -#ifndef        STDIN_FILENO
30 -#define        STDIN_FILENO    0
31 -#endif
32         if (inname == NULL)
33                 fd = STDIN_FILENO;
34         else if ((fd = open(inname, O_RDONLY)) < 0) {
This page took 0.026718 seconds and 3 git commands to generate.