[RFC PATCH] Ignore fflush(3) return value

Dmitry V. Levin ldv at altlinux.org
Mon Sep 17 22:57:24 UTC 2012


strace used to honor fflush(3) return value in trace_syscall_entering
which resulted to tracees not being PTRACE_SYSCALL'ed which in turn
caused nasty hangups like this one:

$ strace -o'|:' pwd
|:: Broken pipe

There is little strace can do in case of fflush(3) returning EOF, and
hangup is certainly not the best solution for the issue.

* syscall.c (trace_syscall_entering): Ignore fflush(3) return value.
---
 syscall.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/syscall.c b/syscall.c
index 52d742f..35f1608 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1581,8 +1581,7 @@ trace_syscall_entering(struct tcb *tcp)
 	else
 		res = (*sysent[tcp->scno].sys_func)(tcp);
 
-	if (fflush(tcp->outf) == EOF)
-		return -1;
+	fflush(tcp->outf);
  ret:
 	tcp->flags |= TCB_INSYSCALL;
 	/* Measure the entrance time as late as possible to avoid errors. */

-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120918/024afdb6/attachment.bin>


More information about the Strace-devel mailing list