cvs: php4(PHP_4_2_0) /ext/pcntl pcntl.c

From: Date: Tue, 23 Apr 2002 21:25:51 +0000
Subject: cvs: php4(PHP_4_2_0) /ext/pcntl pcntl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11362@lists.php.net to get a copy of this message
mfischer Tue Apr 23 17:25:51 2002 EDT Modified files: (Branch: PHP_4_2_0) /php4/ext/pcntl pcntl.c Log: - MFH fix for #16766. Index: php4/ext/pcntl/pcntl.c diff -u php4/ext/pcntl/pcntl.c:1.19 php4/ext/pcntl/pcntl.c:1.19.2.1 --- php4/ext/pcntl/pcntl.c:1.19 Thu Feb 28 03:26:34 2002 +++ php4/ext/pcntl/pcntl.c Tue Apr 23 17:25:50 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pcntl.c,v 1.19 2002/02/28 08:26:34 sebastian Exp $ */ +/* $Id: pcntl.c,v 1.19.2.1 2002/04/23 21:25:50 mfischer Exp $ */ #define PCNTL_DEBUG 0 @@ -222,24 +222,21 @@ Waits on or returns the status of a forked child as defined by the waitpid() system call */ PHP_FUNCTION(pcntl_waitpid) { - zval **pid, **status, **options; - int temp_options, temp_status=0; - pid_t temp_id; + long pid, options = 0; + zval *z_status = NULL; + int status; + pid_t child_id; - if (ZEND_NUM_ARGS() > 3 || ZEND_NUM_ARGS() < 2 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &pid, &status, &options) == FAILURE) { - WRONG_PARAM_COUNT; - } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, &z_status, &options) == FAILURE) + return; + + status = Z_LVAL_P(z_status); + + child_id = waitpid((pid_t) pid, &status, options); + + Z_LVAL_P(z_status) = status; - convert_to_long_ex(pid); - convert_to_long_ex(options); - convert_to_long_ex(status); - - if (ZEND_NUM_ARGS()==2) temp_options=0; - else temp_options=Z_LVAL_PP(options); - - temp_id = waitpid((pid_t) Z_LVAL_PP(pid), &temp_status, temp_options); - Z_LVAL_PP(status)=temp_status; - RETURN_LONG((long) temp_id); + RETURN_LONG((long) child_id); } /* }}} */

« previous php.cvs (#11362) next »