summaryrefslogtreecommitdiff
path: root/src/readcdf.c
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2012-02-20 20:04:58 +0000
committerChristos Zoulas <christos@zoulas.com>2012-02-20 20:04:58 +0000
commit67d15218f057440c187d7ff671d0c135a5bf4ece (patch)
tree82204c93d0861c52096b55c131d2329dd2be4adb /src/readcdf.c
parent901672189f6d1d1251df84d945bb3cd9c210a066 (diff)
downloadfile-git-67d15218f057440c187d7ff671d0c135a5bf4ece.tar.gz
return -2 if we printed something so the we don't print the same information
twice.
Diffstat (limited to 'src/readcdf.c')
-rw-r--r--src/readcdf.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/readcdf.c b/src/readcdf.c
index 8f439d5e..bc46a3ee 100644
--- a/src/readcdf.c
+++ b/src/readcdf.c
@@ -26,7 +26,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.27 2011/09/28 13:30:10 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.28 2012/02/17 05:27:45 christos Exp $")
#endif
#include <stdlib.h>
@@ -173,30 +173,31 @@ cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
return -1;
if (NOTMIME(ms)) {
- if (file_printf(ms, "Composite Document File V2 Document") == -1)
+ if (file_printf(ms, "Composite Document File V2 Document")
+ == -1)
return -1;
if (file_printf(ms, ", %s Endian",
si.si_byte_order == 0xfffe ? "Little" : "Big") == -1)
- return -1;
+ return -2;
switch (si.si_os) {
case 2:
if (file_printf(ms, ", Os: Windows, Version %d.%d",
si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1)
- return -1;
+ return -2;
break;
case 1:
if (file_printf(ms, ", Os: MacOS, Version %d.%d",
(uint32_t)si.si_os_version >> 8,
si.si_os_version & 0xff) == -1)
- return -1;
+ return -2;
break;
default:
if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
si.si_os_version & 0xff,
(uint32_t)si.si_os_version >> 8) == -1)
- return -1;
+ return -2;
break;
}
}
@@ -204,7 +205,7 @@ cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h,
m = cdf_file_property_info(ms, info, count);
free(info);
- return m;
+ return m == -1 ? -2 : m;
}
protected int
@@ -273,7 +274,7 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
#ifdef CDF_DEBUG
cdf_dump_summary_info(&h, &scn);
#endif
- if ((i = cdf_file_summary_info(ms, &h, &scn)) == -1)
+ if ((i = cdf_file_summary_info(ms, &h, &scn)) < 0)
expn = "Can't expand summary_info";
if (i == 0) {
const char *str = "vnd.ms-office";
@@ -304,9 +305,10 @@ out1:
free(sat.sat_tab);
out0:
if (i != 1) {
- if (file_printf(ms, "Composite Document File V2 Document")
- == -1)
- return -1;
+ if (i == -1)
+ if (file_printf(ms, "Composite Document File V2 Document")
+ == -1)
+ return -1;
if (*expn)
if (file_printf(ms, ", %s%s", corrupt, expn) == -1)
return -1;