From: Reuben Thomas Date: Thu, 30 Oct 2008 10:43:49 +0000 (+0000) Subject: Fix handle_annotation to allow both Apple and MIME types to be X-Git-Tag: FILE5_00~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f21deb6cfe8ce154e71e9dfa503f29b5bfa5803;p=file Fix handle_annotation to allow both Apple and MIME types to be printed, and to return correct code if MIME type is printed (1, not 0) or if there's an error (-1 not 1). --- diff --git a/ChangeLog b/ChangeLog index 42a5c132..693cc641 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ +2008-10-18 11:00 Reuben Thomas + + * Correct words counts in comments of struct magic. + + * Fix handle_annotation to allow both Apple and MIME types to be + printed, and to return correct code if MIME type is + printed (1, not 0) or if there's an error (-1 not 1). + 2008-10-18 16:45 Christos Zoulas - + * Added APPLE file creator/type 2008-10-12 10:20 Christos Zoulas @@ -12,7 +20,7 @@ 2008-10-09 13:20 Christos Zoulas - * correct --exclude documentation issues: remove troff and fortran + * correct --exclude documentation issues: remove troff and fortran and rename "token" to "tokens". (Randy McMurchy) 2008-10-01 10:30 Christos Zoulas @@ -20,12 +28,22 @@ * Read ~/.magic in addition to the default magic file not instead of, as documented in the man page. +2008-09-10 21:30 Reuben Thomas + + * Comment out graphviz patterns, as they match too many files. + 2008-08-30 12:54 Christos Zoulas * Don't eat trailing \n in magic enties. * Cast defines to allow compilation using a c++ compiler. +2008-08-25 23:56 Reuben Thomas + + * Add text/x-lua MIME type for Lua scripts. + + * Escape { in regex in graphviz patterns. + 2008-07-26 00:59 Reuben Thomas * Add MIME types for special files. diff --git a/src/softmagic.c b/src/softmagic.c index ea5481ca..9ab83f4d 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -38,7 +38,7 @@ #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.123 2008/10/16 16:31:16 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.124 2008/10/18 20:47:48 christos Exp $") #endif /* lint */ private int match(struct magic_set *, struct magic *, uint32_t, @@ -1823,16 +1823,18 @@ magiccheck(struct magic_set *ms, struct magic *m) private int handle_annotation(struct magic_set *ms, struct magic *m) { + int ret = 0; if (ms->flags & MAGIC_APPLE) { if (file_printf(ms, "%.8s", m->apple) == -1) return -1; - return 1; + ret = 1; } if (ms->flags & MAGIC_MIME_TYPE) { - if (file_printf(ms, "%.8s", m->mimetype) == -1) - return 1; + if (file_printf(ms, "%s", m->mimetype) == -1) + return -1; + ret = 1; } - return 0; + return ret; } private int