Package: timeout
Version: 1.11-6.3
Severity: normal
Tags: patch

$ timeout 10 bash -c "exit 256" ; echo $?
0

wait doesn't return the child exit status, you need WEXITSTATUS() for that.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to ca_ES.UTF-8)

Versions of packages timeout depends on:
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries

timeout recommends no packages.

-- no debconf information
diff -ur tct-1.11.old/src/misc/timeout.c tct-1.11/src/misc/timeout.c
--- tct-1.11.old/src/misc/timeout.c	2001-09-09 23:46:10.000000000 +0200
+++ tct-1.11/src/misc/timeout.c	2007-07-17 14:29:11.000000000 +0200
@@ -30,6 +30,7 @@
 /* System libraries. */
 
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -103,6 +104,6 @@
 	alarm(time_to_run);
 	while ((pid = wait(&status)) != -1 && pid != child_pid)
 	     /* void */ ;
-	return (pid == child_pid ? status : -1);
+	return (pid == child_pid ? WEXITSTATUS(status) : -1);
     }
 }

Reply via email to