From b310a0c26b3b31d52aa4b25549e06113284bd5bb Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 6 Nov 2003 23:41:22 +0000 Subject: [PATCH] 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. --- strace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; } -- 2.40.0