cherry-pick.FILE5_25-4-gc12b1c8.annotations-are-attached-to-the-first-description-entry-print-them-then.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Subject: annotations are attached to the first description entry, print them then
  2. Origin: FILE5_25-4-gc12b1c8
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Wed Sep 16 22:17:12 2015 +0000
  5. --- a/src/softmagic.c
  6. +++ b/src/softmagic.c
  7. @@ -228,17 +228,17 @@
  8. continue;
  9. }
  10. - if ((e = handle_annotation(ms, m)) != 0) {
  11. - *need_separator = 1;
  12. - *printed_something = 1;
  13. - *returnval = 1;
  14. - return e;
  15. - }
  16. /*
  17. * If we are going to print something, we'll need to print
  18. * a blank before we print something else.
  19. */
  20. if (*m->desc) {
  21. + if ((e = handle_annotation(ms, m)) != 0) {
  22. + *need_separator = 1;
  23. + *printed_something = 1;
  24. + *returnval = 1;
  25. + return e;
  26. + }
  27. *need_separator = 1;
  28. *printed_something = 1;
  29. if (print_sep(ms, firstline) == -1)
  30. @@ -318,17 +318,17 @@
  31. break;
  32. } else
  33. ms->c.li[cont_level].got_match = 1;
  34. - if ((e = handle_annotation(ms, m)) != 0) {
  35. - *need_separator = 1;
  36. - *printed_something = 1;
  37. - *returnval = 1;
  38. - return e;
  39. - }
  40. /*
  41. * If we are going to print something,
  42. * make sure that we have a separator first.
  43. */
  44. if (*m->desc) {
  45. + if ((e = handle_annotation(ms, m)) != 0) {
  46. + *need_separator = 1;
  47. + *printed_something = 1;
  48. + *returnval = 1;
  49. + return e;
  50. + }
  51. if (!*printed_something) {
  52. *printed_something = 1;
  53. if (print_sep(ms, firstline)
  54. @@ -2166,6 +2166,7 @@
  55. private int
  56. handle_annotation(struct magic_set *ms, struct magic *m)
  57. {
  58. +printf("desc = %s, ext = %s mime = %s\n", m->desc, m->ext, m->mimetype);
  59. if (ms->flags & MAGIC_APPLE) {
  60. if (file_printf(ms, "%.8s", m->apple) == -1)
  61. return -1;