From c83b0586d00d87ee587a71d5d570996ea8140344 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Tue, 22 Sep 2015 15:40:32 +0000 Subject: [PATCH] Fix --mime-encoding without --mime-type (Christoph Biedl) printf '\x00\xff' | file --mime-encoding - --- src/funcs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/funcs.c b/src/funcs.c index 24d1866a..9693bf0b 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.85 2015/09/17 01:10:51 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.86 2015/09/17 01:14:09 christos Exp $") #endif /* lint */ #include "magic.h" @@ -293,7 +293,8 @@ simple: /* give up */ m = 1; if (ms->flags & MAGIC_MIME) { - if (file_printf(ms, "%s", type) == -1) + if ((ms->flags & MAGIC_MIME_TYPE) && + file_printf(ms, "%s", type) == -1) rv = -1; } else if (ms->flags & MAGIC_APPLE) { if (file_printf(ms, "UNKNUNKN") == -1) -- 2.40.0