cherry-pick.FILE5_25-9-g9039ec5.make-the-default-case-print-something-sane-for-each-of-the-different-styles.patch 987 B

1234567891011121314151617181920212223242526272829303132
  1. Subject: Make the default case print something sane for each of the different styles: (...)
  2. Origin: FILE5_25-9-g9039ec5
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Thu Sep 17 01:10:51 2015 +0000
  5. Make the default case print something sane for each of the different styles:
  6. apple, mime, encoding, default. Before it just printed data which is confusing.
  7. --- a/src/funcs.c
  8. +++ b/src/funcs.c
  9. @@ -293,9 +293,18 @@
  10. simple:
  11. /* give up */
  12. m = 1;
  13. - if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
  14. - file_printf(ms, "%s", mime ? type : def) == -1) {
  15. - rv = -1;
  16. + if (ms->flags & MAGIC_MIME) {
  17. + if (file_printf(ms, "%s", type) == -1)
  18. + rv = -1;
  19. + } else if (ms->flags & MAGIC_APPLE) {
  20. + if (file_printf(ms, "UNKNUNKN") == -1)
  21. + rv = -1;
  22. + } else if (ms->flags & MAGIC_EXTENSION) {
  23. + if (file_printf(ms, "???") == -1)
  24. + rv = -1;
  25. + } else {
  26. + if (file_printf(ms, "%s", def) == -1)
  27. + rv = -1;
  28. }
  29. done:
  30. if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {