]> granicus.if.org Git - file/commitdiff
Fix --mime-encoding without --mime-type (Christoph Biedl)
authorChristos Zoulas <christos@zoulas.com>
Tue, 22 Sep 2015 15:40:32 +0000 (15:40 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 22 Sep 2015 15:40:32 +0000 (15:40 +0000)
printf '\x00\xff' | file --mime-encoding -

src/funcs.c

index fc105f2a8485f8ec27ee49014668285d3f65ca08..a26677219421420e825ac891f8949a8225b77e19 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.86 2015/09/17 01:14:09 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.87 2015/09/22 15:40:32 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)