From: Roland McGrath Date: Thu, 6 Nov 2003 23:41:22 +0000 (+0000) Subject: 2003-11-06 Roland McGrath X-Git-Tag: v4.5.18~680 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b310a0c26b3b31d52aa4b25549e06113284bd5bb;p=strace 2003-11-06 Roland McGrath * strace.c (tprintf): Check result of vfprintf and use perror when it fails while not writing to stderr itself. Fixes Debian bug #218762. --- diff --git a/strace.c b/strace.c index 13b42d4d..02d1e6e8 100644 --- a/strace.c +++ b/strace.c @@ -2213,8 +2213,14 @@ va_dcl va_list args; VA_START(args, fmt); - if (outf) - curcol += vfprintf(outf, fmt, args); + if (outf) { + int n = vfprintf(outf, fmt, args); + if (n < 0 && outf != stderr) + perror(outfname == NULL + ? "" : outfname); + else + curcol += n; + } va_end(args); return; }