stas                                     Tue, 06 Sep 2011 05:28:25 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=316207

Log:
allow user streams to override ch* on windows too

Changed paths:
    U   php/php-src/branches/PHP_5_4/ext/standard/filestat.c
    U   php/php-src/trunk/ext/standard/filestat.c

Modified: php/php-src/branches/PHP_5_4/ext/standard/filestat.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/standard/filestat.c        2011-09-06 
05:21:56 UTC (rev 316206)
+++ php/php-src/branches/PHP_5_4/ext/standard/filestat.c        2011-09-06 
05:28:25 UTC (rev 316207)
@@ -415,6 +415,7 @@
 #endif
                return SUCCESS;
 }
+#endif

 static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
 {
@@ -450,11 +451,18 @@
                                RETURN_FALSE;
                        }
                } else {
+#if !defined(WINDOWS)
+/* On Windows, we expect regular chgrp to fail silently by default */
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not 
call chgrp() for a non-standard stream");
+#endif
                        RETURN_FALSE;
                }
        }

+#if defined(WINDOWS)
+       /* We have no native chgrp on Windows, nothing left to do if stream 
doesn't have own implementation */
+       RETURN_FALSE;
+#else
        if (Z_TYPE_P(group) == IS_LONG) {
                gid = (gid_t)Z_LVAL_P(group);
        } else if (Z_TYPE_P(group) == IS_STRING) {
@@ -484,20 +492,16 @@
                RETURN_FALSE;
        }
        RETURN_TRUE;
+#endif
 }
 /* }}} */
-#endif

 #ifndef NETWARE
 /* {{{ proto bool chgrp(string filename, mixed group)
    Change file group */
 PHP_FUNCTION(chgrp)
 {
-#if !defined(WINDOWS)
        php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-#else
-       RETURN_FALSE;
-#endif
 }
 /* }}} */

@@ -546,6 +550,7 @@
 #endif
                return SUCCESS;
 }
+#endif

 static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
 {
@@ -581,11 +586,19 @@
                                RETURN_FALSE;
                        }
                } else {
+#if !defined(WINDOWS)
+/* On Windows, we expect regular chown to fail silently by default */
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not 
call chown() for a non-standard stream");
+#endif
                        RETURN_FALSE;
                }
        }

+#if defined(WINDOWS)
+       /* We have no native chown on Windows, nothing left to do if stream 
doesn't have own implementation */
+       RETURN_FALSE;
+#else
+
        if (Z_TYPE_P(user) == IS_LONG) {
                uid = (uid_t)Z_LVAL_P(user);
        } else if (Z_TYPE_P(user) == IS_STRING) {
@@ -614,21 +627,18 @@
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", 
strerror(errno));
                RETURN_FALSE;
        }
+       RETURN_TRUE;
+#endif
 }
 /* }}} */
-#endif

+
 #ifndef NETWARE
 /* {{{ proto bool chown (string filename, mixed user)
    Change file owner */
 PHP_FUNCTION(chown)
 {
-#if !defined(WINDOWS)
-       RETVAL_TRUE;
        php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-#else
-       RETURN_FALSE;
-#endif
 }
 /* }}} */


Modified: php/php-src/trunk/ext/standard/filestat.c
===================================================================
--- php/php-src/trunk/ext/standard/filestat.c   2011-09-06 05:21:56 UTC (rev 
316206)
+++ php/php-src/trunk/ext/standard/filestat.c   2011-09-06 05:28:25 UTC (rev 
316207)
@@ -415,6 +415,7 @@
 #endif
                return SUCCESS;
 }
+#endif

 static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
 {
@@ -450,11 +451,18 @@
                                RETURN_FALSE;
                        }
                } else {
+#if !defined(WINDOWS)
+/* On Windows, we expect regular chgrp to fail silently by default */
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not 
call chgrp() for a non-standard stream");
+#endif
                        RETURN_FALSE;
                }
        }

+#if defined(WINDOWS)
+       /* We have no native chgrp on Windows, nothing left to do if stream 
doesn't have own implementation */
+       RETURN_FALSE;
+#else
        if (Z_TYPE_P(group) == IS_LONG) {
                gid = (gid_t)Z_LVAL_P(group);
        } else if (Z_TYPE_P(group) == IS_STRING) {
@@ -484,20 +492,16 @@
                RETURN_FALSE;
        }
        RETURN_TRUE;
+#endif
 }
 /* }}} */
-#endif

 #ifndef NETWARE
 /* {{{ proto bool chgrp(string filename, mixed group)
    Change file group */
 PHP_FUNCTION(chgrp)
 {
-#if !defined(WINDOWS)
        php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-#else
-       RETURN_FALSE;
-#endif
 }
 /* }}} */

@@ -546,6 +550,7 @@
 #endif
                return SUCCESS;
 }
+#endif

 static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
 {
@@ -581,11 +586,19 @@
                                RETURN_FALSE;
                        }
                } else {
+#if !defined(WINDOWS)
+/* On Windows, we expect regular chown to fail silently by default */
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can not 
call chown() for a non-standard stream");
+#endif
                        RETURN_FALSE;
                }
        }

+#if defined(WINDOWS)
+       /* We have no native chown on Windows, nothing left to do if stream 
doesn't have own implementation */
+       RETURN_FALSE;
+#else
+
        if (Z_TYPE_P(user) == IS_LONG) {
                uid = (uid_t)Z_LVAL_P(user);
        } else if (Z_TYPE_P(user) == IS_STRING) {
@@ -614,21 +627,18 @@
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", 
strerror(errno));
                RETURN_FALSE;
        }
+       RETURN_TRUE;
+#endif
 }
 /* }}} */
-#endif

+
 #ifndef NETWARE
 /* {{{ proto bool chown (string filename, mixed user)
    Change file owner */
 PHP_FUNCTION(chown)
 {
-#if !defined(WINDOWS)
-       RETVAL_TRUE;
        php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-#else
-       RETURN_FALSE;
-#endif
 }
 /* }}} */


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to