[PATCH] fix display of dirfd with x86 binary and x86_64 strace

Mike Frysinger vapier at gentoo.org
Sun Apr 5 06:00:41 UTC 2009


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

diff --git a/file.c b/file.c
index 614ba1e..138bac0 100644
--- a/file.c
+++ b/file.c
@@ -328,13 +328,16 @@ const struct xlat open_mode_flags[] = {
 # define AT_FDCWD                -100
 #endif
 
+/* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
+ * extension to get the right value.  We do this by declaring fd as int here.
+ */
 static void
-print_dirfd(long fd)
+print_dirfd(int fd)
 {
 	if (fd == AT_FDCWD)
 		tprintf("AT_FDCWD, ");
 	else
-		tprintf("%ld, ", fd);
+		tprintf("%d, ", fd);
 }
 #endif
 
-- 
1.6.2.2





More information about the Strace-devel mailing list