* file.c (print_dirfd): Use int for file descriptor, not a long.
* process.c (printwaitn): Use int for PID, not a long.
diff --git a/ChangeLog b/ChangeLog
index 6ae08a3..0db8a63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-16  Denys Vlasenko  <dvlasenk@redhat.com>
+
+	* file.c (print_dirfd): Use int for file descriptor, not a long.
+	* process.c (printwaitn): Use int for PID, not a long.
+
 2009-04-15  Denys Vlasenko  <dvlasenk@redhat.com>
 
 	* signal (sys_rt_sigtimedwait): Fix sigtimedwait syscall decoding.
@@ -86,7 +91,7 @@
 	In some cases, missing error checking is added.
 	Error handling for trace_syscall() failures and other cases
 	where tcp->ptrace_errno is nonzero is cleaned up a bit
-	and made more verbose if we see error other than ESRC.
+	and made more verbose if we see error other than ESRCH.
 	Some comments are added or expanded.
 	* defs.h: Declare ptrace_cmds[]. Modify do_ptrace
 	declaration (last parameter is long, not void *).
diff --git a/file.c b/file.c
index a8401cf..080e10b 100644
--- a/file.c
+++ b/file.c
@@ -327,13 +327,16 @@
 # 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
 
diff --git a/process.c b/process.c
index 9ddae08..1ddf2f3 100644
--- a/process.c
+++ b/process.c
@@ -1998,21 +1998,24 @@
 	int exited = 0;
 
 	if (entering(tcp)) {
-		/*
-		 * Sign-extend a 32-bit value when that's what it is.
-		 *
-		 * NB: On Linux, kernel-side pid_t is typedef'ed to int
-		 * on all arches; also, glibc-2.8 truncates wait3 and wait4
+#ifdef LINUX
+		/* On Linux, kernel-side pid_t is typedef'ed to int
+		 * on all arches. Also, glibc-2.8 truncates wait3 and wait4
 		 * pid argument to int on 64bit arches, producing,
 		 * for example, wait4(4294967295, ...) instead of -1
-		 * in strace.
-		 * Therefore, maybe it makes sense to *unconditionally*
-		 * widen int to long here...
+		 * in strace. We have to use int here, not long.
+		 */
+		int pid = tcp->u_arg[0];
+		tprintf("%d, ", pid);
+#else
+		/*
+		 * Sign-extend a 32-bit value when that's what it is.
 		 */
 		long pid = tcp->u_arg[0];
 		if (personality_wordsize[current_personality] < sizeof pid)
 			pid = (long) (int) pid;
 		tprintf("%ld, ", pid);
+#endif
 	} else {
 		/* status */
 		if (!tcp->u_arg[1])