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