diff --git a/contrib/file/src/magic.c b/contrib/file/src/magic.c index 315a94420c4a..8cf62694383d 100644 --- a/contrib/file/src/magic.c +++ b/contrib/file/src/magic.c @@ -346,7 +346,7 @@ private void close_and_restore(const struct magic_set *ms, const char *name, int fd, const struct stat *sb) { - if (name == NULL) + if (fd == STDIN_FILENO || name == NULL) return; (void) close(fd);