]> granicus.if.org Git - file/commitdiff
cat /dev/null | file - should print empty (Christoph Biedl)
authorChristos Zoulas <christos@zoulas.com>
Mon, 18 Jul 2016 11:43:05 +0000 (11:43 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 18 Jul 2016 11:43:05 +0000 (11:43 +0000)
src/magic.c

index 4474793a1ecc3b440a2f24fb7bfb945d7d7230be..a9b7e32af857b24a5714f477952a07cb1b8b01d8 100644 (file)
@@ -33,7 +33,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: magic.c,v 1.98 2016/04/19 20:51:54 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.99 2016/05/03 16:09:38 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -492,7 +492,7 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
                        if (r < PIPE_BUF) break;
                }
 
-               if (nbytes == 0) {
+               if (nbytes == 0 && inname) {
                        /* We can not read it, but we were able to stat it. */
                        if (unreadable_info(ms, sb.st_mode, inname) == -1)
                                goto done;