summaryrefslogtreecommitdiff
path: root/ext/posix/posix.c
diff options
context:
space:
mode:
authorMarkus Fischer <mfischer@php.net>2002-05-20 23:26:13 +0000
committerMarkus Fischer <mfischer@php.net>2002-05-20 23:26:13 +0000
commit94501132c63a3b655bbee64ce41ad78502a3bab1 (patch)
treebc8465bc5832443667136584237338ef882b35b6 /ext/posix/posix.c
parentd24f7420d0d35aba196ef7238739aadd95a065a4 (diff)
downloadphp-git-94501132c63a3b655bbee64ce41ad78502a3bab1.tar.gz
- Fix posix_isatty() and posix_ttyname() (Closes #17323)
Diffstat (limited to 'ext/posix/posix.c')
-rw-r--r--ext/posix/posix.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 4ea521997e..d3046b2090 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -584,13 +584,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;
}
@@ -603,13 +605,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;