From: Markus Fischer Date: Mon, 20 May 2002 23:31:02 +0000 (+0000) Subject: - MFH fix for #17323. X-Git-Tag: php-4.2.3RC1~126 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fef95081c1ce6cdd24751783429e93993f464849;p=php - MFH fix for #17323. --- diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 6f8dc85122..fd4778ac32 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -585,13 +585,15 @@ PHP_FUNCTION(posix_ctermid) 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; } @@ -604,13 +606,15 @@ PHP_FUNCTION(posix_ttyname) 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;