From: Christos Zoulas Date: Mon, 17 Oct 2005 15:13:31 +0000 (+0000) Subject: don't try to close stdin. X-Git-Tag: FILE4_16~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73c33b601b7e8f79ef1fe92a32f785642638ca02;p=file don't try to close stdin. --- diff --git a/src/magic.c b/src/magic.c index 06afddcb..ab4ac73e 100644 --- a/src/magic.c +++ b/src/magic.c @@ -63,7 +63,7 @@ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: magic.c,v 1.29 2005/08/27 08:12:19 christos Exp $") +FILE_RCSID("@(#)$Id: magic.c,v 1.30 2005/10/17 15:13:31 christos Exp $") #endif /* lint */ #ifdef __EMX__ @@ -179,8 +179,11 @@ private void close_and_restore(const struct magic_set *ms, const char *name, int fd, const struct stat *sb) { + if (fd == STDIN_FILENO) + return; (void) close(fd); - if (fd != STDIN_FILENO && (ms->flags & MAGIC_PRESERVE_ATIME) != 0) { + + if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) { /* * Try to restore access, modification times if read it. * This is really *bad* because it will modify the status