summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2005-11-02 15:53:49 +0000
committerDerick Rethans <derick@php.net>2005-11-02 15:53:49 +0000
commit703fc059bf49c0183c3c4a5bc6ab31c9e4f8a93e (patch)
treeaa70fd87bcf90eb38418be520e51127f31ea2800
parent496fd1c0414b7cf736304f0a3cccb2e685b70b87 (diff)
downloadphp-git-703fc059bf49c0183c3c4a5bc6ab31c9e4f8a93e.tar.gz
- MFH: Fixed initializing and argument checking for posix_mknod().
-rw-r--r--NEWS1
-rw-r--r--ext/posix/posix.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 6d542bf187..8b31b01e1d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Nov 2005, PHP 5.1
+- Fixed initializing and argument checking for posix_mknod(). (Derick)
- Fixed bugs #35022, #35019 (Regression in the behavior of key() and current()
functions). (Ilia)
- Fixed bug #35017 (Exception thrown in error handler may cause unexpected
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 26b76cc4bf..890609e565 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -676,7 +676,7 @@ PHP_FUNCTION(posix_mknod)
char *path;
int path_len;
long mode;
- long major, minor = 0;
+ long major = 0, minor = 0;
int result;
dev_t php_dev;
@@ -693,9 +693,13 @@ PHP_FUNCTION(posix_mknod)
}
if ((mode & S_IFCHR) || (mode & S_IFBLK)) {
+ if (ZEND_NUM_ARGS() == 2) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "For S_IFCHR and S_IFBLK you need to pass a major device kernel identifier");
+ RETURN_FALSE;
+ }
if (major == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
- "expects argument 4 to be non-zero for POSIX_S_IFCHR and POSIX_S_IFBLK");
+ "Expects argument 3 to be non-zero for POSIX_S_IFCHR and POSIX_S_IFBLK");
RETURN_FALSE;
} else {
#if defined(HAVE_MAKEDEV) || defined(makedev)