#!/bin/sh /usr/share/dpatch/dpatch-run ## 907-file-funcs.dpatch by Martin Dorey ## ## DP: Fixing regression in file 4.24 with file_printf(); (Closes: #481523). @DPATCH@ diff -Naurp file-4.24.orig/src/funcs.c file-4.24/src/funcs.c --- file-4.24.orig/src/funcs.c 2008-05-04 14:12:49.000000000 +0000 +++ file-4.24/src/funcs.c 2008-05-21 08:54:06.000000000 +0000 @@ -45,18 +45,15 @@ FILE_RCSID("@(#)$File: funcs.c,v 1.39 20 * Like printf, only we append to a buffer. */ protected int -file_printf(struct magic_set *ms, const char *fmt, ...) +file_vprintf(struct magic_set *ms, const char *fmt, va_list ap) { - va_list ap; size_t size; int len; char *buf, *newstr; - va_start(ap, fmt); len = vasprintf(&buf, fmt, ap); if (len < 0) goto out; - va_end(ap); if (ms->o.buf != NULL) { len = asprintf(&newstr, "%s%s", ms->o.buf, buf); @@ -73,6 +70,18 @@ out: return -1; } +protected int +file_printf(struct magic_set *ms, const char *fmt, ...) +{ + va_list ap; + int len; + + va_start(ap, fmt); + len = file_vprintf(ms, fmt, ap); + va_end(ap); + return len; +} + /* * error - print best error message possible */ @@ -89,7 +98,7 @@ file_error_core(struct magic_set *ms, in ms->o.buf = NULL; file_printf(ms, "line %u: ", lineno); } - file_printf(ms, f, va); + file_vprintf(ms, f, va); if (error > 0) file_printf(ms, " (%s)", strerror(error)); ms->haderr++;