cvs: php4 /ext/posix posix.c

From: Date: Mon, 20 May 2002 23:26:13 +0000
Subject: cvs: php4 /ext/posix posix.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12022@lists.php.net to get a copy of this message
mfischer Mon May 20 19:26:13 2002 EDT Modified files: /php4/ext/posix posix.c Log: - Fix posix_isatty() and posix_ttyname() (Closes #17323) Index: php4/ext/posix/posix.c diff -u php4/ext/posix/posix.c:1.46 php4/ext/posix/posix.c:1.47 --- php4/ext/posix/posix.c:1.46 Sat May 4 12:54:13 2002 +++ php4/ext/posix/posix.c Mon May 20 19:26:13 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: posix.c,v 1.46 2002/05/04 16:54:13 sas Exp $ */ +/* $Id: posix.c,v 1.47 2002/05/20 23:26:13 mfischer Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -130,7 +130,7 @@ static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, "Revision", "$Revision: 1.46 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.47 $"); php_info_print_table_end(); } /* }}} */ @@ -584,13 +584,15 @@ Determine terminal device name (POSIX.1, 4.7.2) */ PHP_FUNCTION(posix_ttyname) { - long fd; + zval *z_fd; char *p; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fd) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) return; - if (NULL == (p = ttyname(fd))) { + convert_to_long(z_fd); + + if (NULL == (p = ttyname(Z_LVAL_P(z_fd)))) { POSIX_G(last_error) = errno; RETURN_FALSE; } @@ -603,13 +605,15 @@ Determine if filedesc is a tty (POSIX.1, 4.7.1) */ PHP_FUNCTION(posix_isatty) { - long fd; + zval *z_fd; int result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fd) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) return; - result = isatty(fd); + convert_to_long(z_fd); + + result = isatty(Z_LVAL_P(z_fd)); if (!result) RETURN_FALSE;

« previous php.cvs (#12022) next »