]> granicus.if.org Git - file/commitdiff
PR/559: It is not an error if the short stream is missing.
authorChristos Zoulas <christos@zoulas.com>
Mon, 20 Jun 2016 16:08:14 +0000 (16:08 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 20 Jun 2016 16:08:14 +0000 (16:08 +0000)
src/cdf.c
src/cdf.h
src/readcdf.c

index 1d20453b8ca4358ed22b893edec173448029ddf4..2e201d08e99f1204470357fae45e44d519d7a904 100644 (file)
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.81 2016/06/01 22:21:14 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.82 2016/06/01 22:25:25 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -731,22 +731,25 @@ cdf_read_short_stream(const cdf_info_t *info, const cdf_header_t *h,
                        break;
 
        /* If the it is not there, just fake it; some docs don't have it */
-       if (i == dir->dir_len)
+       if (i == dir->dir_len) {
+               DPRINTF(("Cannot find root storage dir\n"));
                goto out;
+       }
        d = &dir->dir_tab[i];
        *root = d;
 
        /* If the it is not there, just fake it; some docs don't have it */
-       if (d->d_stream_first_sector < 0)
+       if (d->d_stream_first_sector < 0) {
+               DPRINTF(("No first secror in dir\n"));
                goto out;
+       }
 
        return cdf_read_long_sector_chain(info, h, sat,
            d->d_stream_first_sector, d->d_size, scn);
 out:
        scn->sst_tab = NULL;
        (void)cdf_zero_stream(scn);
-       errno = EFTYPE;
-       return -1;
+       return 0;
 }
 
 static int
@@ -1275,7 +1278,7 @@ cdf_dump(const void *v, size_t len)
 }
 
 void
-cdf_dump_stream(const cdf_header_t *h, const cdf_stream_t *sst)
+cdf_dump_stream(const cdf_stream_t *sst)
 {
        size_t ss = sst->sst_ss;
        cdf_dump(sst->sst_tab, ss * sst->sst_len);
@@ -1331,7 +1334,7 @@ cdf_dump_dir(const cdf_info_t *info, const cdf_header_t *h,
                                    name, d->d_stream_first_sector, d->d_size);
                                break;
                        }
-                       cdf_dump_stream(h, &scn);
+                       cdf_dump_stream(&scn);
                        free(scn.sst_tab);
                        break;
                default:
@@ -1507,7 +1510,7 @@ main(int argc, char *argv[])
                    == -1)
                        err(1, "Cannot read short stream");
 #ifdef CDF_DEBUG
-               cdf_dump_stream(&h, &sst);
+               cdf_dump_stream(&sst);
 #endif
 
 #ifdef CDF_DEBUG
index 853a71996b636c3ea36e1e198b76766523492605..8b54f33a747980c2e0f60ae8e1ceac5ecd65d357 100644 (file)
--- a/src/cdf.h
+++ b/src/cdf.h
@@ -336,7 +336,7 @@ char *cdf_u16tos8(char *, size_t, const uint16_t *);
 void cdf_dump_header(const cdf_header_t *);
 void cdf_dump_sat(const char *, const cdf_sat_t *, size_t);
 void cdf_dump(const void *, size_t);
-void cdf_dump_stream(const cdf_header_t *, const cdf_stream_t *);
+void cdf_dump_stream(const cdf_stream_t *);
 void cdf_dump_dir(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
     const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *);
 void cdf_dump_property_info(const cdf_property_info_t *, size_t);
index d125da5b22c23edd472f78848c3d971b264b4fa0..efdb68c1c4eed90b60f8d4ccccc3d6f7739eec00 100644 (file)
@@ -26,7 +26,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.56 2016/03/03 22:20:03 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.57 2016/05/03 16:08:49 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -373,7 +373,7 @@ cdf_file_catalog_info(struct magic_set *ms, const cdf_info_t *info,
            dir, "Catalog", scn)) == -1)
                return i;
 #ifdef CDF_DEBUG
-       cdf_dump_catalog(&h, scn);
+       cdf_dump_catalog(h, scn);
 #endif
        if ((i = cdf_file_catalog(ms, h, scn)) == -1)
                return -1;