cherry-pick.FILE5_25-12-gc83b058.fix-mime-encoding-without-mime-type.patch 656 B

123456789101112131415161718192021
  1. Subject: Fix --mime-encoding without --mime-type
  2. Origin: FILE5_25-12-gc83b058
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Tue Sep 22 15:40:32 2015 +0000
  5. Bug-Debian: https://bugs.debian.org/799690
  6. Fix --mime-encoding without --mime-type (Christoph Biedl)
  7. printf '\x00\xff' | file --mime-encoding -
  8. --- a/src/funcs.c
  9. +++ b/src/funcs.c
  10. @@ -294,7 +294,8 @@
  11. /* give up */
  12. m = 1;
  13. if (ms->flags & MAGIC_MIME) {
  14. - if (file_printf(ms, "%s", type) == -1)
  15. + if ((ms->flags & MAGIC_MIME_TYPE) &&
  16. + file_printf(ms, "%s", type) == -1)
  17. rv = -1;
  18. } else if (ms->flags & MAGIC_APPLE) {
  19. if (file_printf(ms, "UNKNUNKN") == -1)