]> granicus.if.org Git - file/commitdiff
for files that are missing summary info, don't print that they are corrupt.
authorChristos Zoulas <christos@zoulas.com>
Sun, 13 Sep 2009 23:23:31 +0000 (23:23 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sun, 13 Sep 2009 23:23:31 +0000 (23:23 +0000)
src/readcdf.c

index 8f865c01057b82cde28c8d51b34fec202a8cd6b6..60915c9646ee1424aa9a40b3c886c709168a0cfd 100644 (file)
@@ -26,7 +26,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.19 2009/05/08 17:41:59 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.20 2009/07/15 15:17:44 christos Exp $")
 #endif
 
 #include <stdlib.h>
@@ -202,6 +202,7 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
        cdf_dir_t dir;
        int i;
        const char *expn = "";
+       const char *corrupt = "corrupt: ";
 
        info.i_fd = fd;
        info.i_buf = buf;
@@ -245,7 +246,12 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
 
        if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
            &scn)) == -1) {
-               expn = "Cannot read summary info";
+               if (errno == ESRCH) {
+                       corrupt = expn;
+                       expn = "No summary info";
+               } else {
+                       expn = "Cannot read summary info";
+               }
                goto out4;
        }
 #ifdef CDF_DEBUG
@@ -267,7 +273,7 @@ out0:
                if (file_printf(ms, "CDF V2 Document") == -1)
                        return -1;
                if (*expn)
-                       if (file_printf(ms, ", corrupt: %s", expn) == -1)
+                       if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
                                return -1;
                i = 1;
        }