]> 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 24d1866a5cda62b8041be3deb83b9e947d89b995..9693bf0b31a0e8e7302c59f90e2e179a150eeefa 100644 (file)
@@ -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)