]> granicus.if.org Git - php/commitdiff
- MFH: Fixed initializing and argument checking for posix_mknod().
authorDerick Rethans <derick@php.net>
Wed, 2 Nov 2005 15:53:49 +0000 (15:53 +0000)
committerDerick Rethans <derick@php.net>
Wed, 2 Nov 2005 15:53:49 +0000 (15:53 +0000)
NEWS
ext/posix/posix.c

diff --git a/NEWS b/NEWS
index 6d542bf18702c5cb1026accea075094c7f52906b..8b31b01e1d2e1e1dbc41ed364b4c86e8e71076e2 100644 (file)
--- 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
index 26b76cc4bffdb1f5d66a7cc7eafeebad0a8db777..890609e565f7e805a8cefac2ec93d12e3d8d9a5d 100644 (file)
@@ -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)