905-file-segfault.dpatch 728 B

12345678910111213141516171819202122
  1. #!/bin/sh /usr/share/dpatch/dpatch-run
  2. ## 905-file-segfault.dpatch by Sven Anders <anders@anduras.de>
  3. ##
  4. ## DP: Fixes a segfault with -c.
  5. @DPATCH@
  6. diff -Naurp file-4.23.orig/src/print.c file-4.23/src/print.c
  7. --- file-4.23.orig/src/print.c 2007-12-27 16:35:59.000000000 +0000
  8. +++ file-4.23/src/print.c 2008-01-12 17:57:26.000000000 +0000
  9. @@ -189,7 +189,10 @@ file_magwarn(struct magic_set *ms, const
  10. /* cuz we use stdout for most, stderr here */
  11. (void) fflush(stdout);
  12. - (void) fprintf(stderr, "%s, %lu: Warning ", ms->file,
  13. + if (!ms->file)
  14. + fprintf(stderr, "Warning ");
  15. + else
  16. + (void) fprintf(stderr, "%s, %lu: Warning ", ms->file,
  17. (unsigned long)ms->line);
  18. (void) vfprintf(stderr, f, va);
  19. va_end(va);