aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/magic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/magic.c b/src/magic.c
index 315a94420c4a..8cf62694383d 100644
--- a/src/magic.c
+++ b/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);