]> granicus.if.org Git - file/commitdiff
PR/405: Ignore exit code from uncompress programs because some (validly)
authorChristos Zoulas <christos@zoulas.com>
Fri, 12 Dec 2014 16:33:01 +0000 (16:33 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 12 Dec 2014 16:33:01 +0000 (16:33 +0000)
exit with non-zero code when they get SIGPIPE.

src/compress.c

index 3330a2be3714e392538ed5cb271b76f4669be2c7..e968bb452850b369be37f42ab1b091fbfa7a53d3 100644 (file)
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.76 2014/12/11 11:47:08 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.77 2014/12/12 16:33:01 christos Exp $")
 #endif
 
 #include "magic.h"
@@ -512,11 +512,16 @@ err:
                            strerror(errno));
 #endif
                        n = NODATA;
-               } else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+               } else if (!WIFEXITED(status)) {
 #ifdef DEBUG
-                       (void)fprintf(stderr, "Child status (0x%x)\n", status);
+                       (void)fprintf(stderr, "Child not exited (0x%x)\n",
+                           status);
+#endif
+               } else if (WEXITSTATUS(status) != 0) {
+#ifdef DEBUG
+                       (void)fprintf(stderr, "Child exited (0x%d)\n",
+                           WEXITSTATUS(status));
 #endif
-                       n = NODATA;
                }
 
                (void) close(fdin[0]);