[PATCH] Fix simultaneous -e read and -e write usage.

Dmitry V. Levin ldv at altlinux.org
Sun Feb 1 01:38:01 UTC 2015


On Sat, Jan 31, 2015 at 11:57:00PM +0100, Aurelien Jacobs wrote:
> This allows using both -e read=FD and -e write=FD at the same time
> with the same FD.
> Without this patch, the -e write=FD is ignored if -e read=FD is used
> at the same time.

Thanks.  I'm going to apply a slightly modified patch:

--- a/syscall.c
+++ b/syscall.c
@@ -2494,17 +2494,21 @@ dumpio(struct tcb *tcp)
 		if (func == sys_read ||
 		    func == sys_pread ||
 		    func == sys_recv ||
-		    func == sys_recvfrom)
+		    func == sys_recvfrom) {
 			dumpstr(tcp, tcp->u_arg[1], tcp->u_rval);
-		else if (func == sys_readv)
+			return;
+		} else if (func == sys_readv) {
 			dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
+			return;
 #if HAVE_SENDMSG
-		else if (func == sys_recvmsg)
+		} else if (func == sys_recvmsg) {
 			dumpiov_in_msghdr(tcp, tcp->u_arg[1]);
-		else if (func == sys_recvmmsg)
+			return;
+		} else if (func == sys_recvmmsg) {
 			dumpiov_in_mmsghdr(tcp, tcp->u_arg[1]);
+			return;
 #endif
-		return;
+		}
 	}
 	if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE) {
 		if (func == sys_write ||
@@ -2520,7 +2524,6 @@ dumpio(struct tcb *tcp)
 		else if (func == sys_sendmmsg)
 			dumpiov_in_mmsghdr(tcp, tcp->u_arg[1]);
 #endif
-		return;
 	}
 }
 
-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150201/25d4c374/attachment.bin>


More information about the Strace-devel mailing list