[PATCH] silence ptrace() integer/pointer warnings

Mike Frysinger vapier at gentoo.org
Wed Oct 7 05:13:39 UTC 2009


The common defs.h code sets up a fallback ptrace() for many arches which
declares the 4th arg as "long" which results in warnings like so:
util.c: In function ‘do_ptrace’:
util.c:260: warning: passing argument 4 of ‘ptrace’ makes integer from pointer without a cast
util.c: In function ‘ptrace_restart’:
util.c:282: warning: passing argument 4 of ‘ptrace’ makes integer from pointer without a cast

* util.c (do_ptrace): Cast 4th arg to long.
(ptrace_restart): Drop void* cast on 4th arg.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 util.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/util.c b/util.c
index c767065..c96eb0a 100644
--- a/util.c
+++ b/util.c
@@ -257,7 +257,7 @@ do_ptrace(int request, struct tcb *tcp, void *addr, void *data)
 	long l;
 
 	errno = 0;
-	l = ptrace(request, tcp->pid, addr, data);
+	l = ptrace(request, tcp->pid, addr, (long) data);
 	/* Non-ESRCH errors might be our invalid reg/mem accesses,
 	 * we do not record them. */
 	if (errno == ESRCH)
@@ -279,7 +279,7 @@ ptrace_restart(int op, struct tcb *tcp, int sig)
 	const char *msg;
 
 	errno = 0;
-	ptrace(op, tcp->pid, (void *) 1, (void *) (long) sig);
+	ptrace(op, tcp->pid, (void *) 1, (long) sig);
 	err = errno;
 	if (!err || err == ESRCH)
 		return 0;
-- 
1.6.5.rc2





More information about the Strace-devel mailing list