lbarnaud                Tue May 26 14:01:39 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/pcntl/tests    bug47566.phpt 

  Modified files:              
    /php-src/ext/pcntl  pcntl.c 
    /php-src/ext/pcntl/tests    001.phpt 
  Log:
  MFH: Fix return value of pcntl_wexitstatus() (fixes #47566,
  patch by james at jamesreno dot com)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.20&r2=1.48.2.2.2.4.2.21&diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.20 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.21
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.20 Sat Mar 28 03:21:04 2009
+++ php-src/ext/pcntl/pcntl.c   Tue May 26 14:01:39 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.20 2009/03/28 03:21:04 mbeccati Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.21 2009/05/26 14:01:39 lbarnaud Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -607,9 +607,7 @@
               return;
        }
 
-       /* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char
-          if you want to have valid negative exit codes */
-       RETURN_LONG((signed char) WEXITSTATUS(status_word));
+       RETURN_LONG(WEXITSTATUS(status_word));
 #else
        RETURN_FALSE;
 #endif
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/001.phpt?r1=1.8.6.1&r2=1.8.6.2&diff_format=u
Index: php-src/ext/pcntl/tests/001.phpt
diff -u php-src/ext/pcntl/tests/001.phpt:1.8.6.1 
php-src/ext/pcntl/tests/001.phpt:1.8.6.2
--- php-src/ext/pcntl/tests/001.phpt:1.8.6.1    Tue Aug  5 15:12:19 2008
+++ php-src/ext/pcntl/tests/001.phpt    Tue May 26 14:01:39 2009
@@ -73,7 +73,7 @@
 Staring wait.h tests....
 
 Testing pcntl_wifexited and wexitstatus....
-Exited With: -1
+Exited With: 255
 
 Testing pcntl_wifsignaled....
 Process was terminated by signal : SIGTERM

http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/bug47566.phpt?view=markup&rev=1.1
Index: php-src/ext/pcntl/tests/bug47566.phpt
+++ php-src/ext/pcntl/tests/bug47566.phpt
--TEST--
Bug #47566 (return value of pcntl_wexitstatus())
--SKIPIF--
<?php if (!extension_loaded("pcntl")) print "skip"; ?>
--FILE--
<?
$pid = pcntl_fork();
if ($pid == -1) {
 echo "Unable to fork";
 exit;
} elseif ($pid) {
 $epid = pcntl_waitpid(-1,$status);
 var_dump(pcntl_wexitstatus($status));
} else {
 exit(128);
}
?>
--EXPECT--
int(128)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to