]> granicus.if.org Git - php/commitdiff
Fixed bug #37505 (touch() truncates large files).
authorIlia Alshanetsky <iliaa@php.net>
Fri, 19 May 2006 02:51:00 +0000 (02:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 19 May 2006 02:51:00 +0000 (02:51 +0000)
NEWS
ext/standard/filestat.c

diff --git a/NEWS b/NEWS
index 7de222656227ed7e778a9e7ea84aac8dfc303039..c072888ff70af97e121c780f59f4637b4fe3202a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,7 @@ PHP                                                                        NEWS
 - Added RFC2397 (data: stream) support. (Marcus)
 - Fixed bug #37510 (session_regenerate_id changes session_id() even on 
   failure). (Hannes)
+- Fixed bug #37505 (touch() truncates large files). (Ilia)
 - Fixed bug #37487 (oci_fetch_array() array-type should always default to
   OCI_BOTH). (Tony)
 - Fixed bug #37395 (recursive mkdir() fails to create nonexistent directories 
index 8d40561c51593095c81150a000a93ae6803eb0d5..d19a29f67cf917292b35ad2bce52652f07affad5 100644 (file)
@@ -538,7 +538,6 @@ PHP_FUNCTION(touch)
 {
        zval **filename, **filetime, **fileatime;
        int ret;
-       struct stat sb;
        FILE *file;
        struct utimbuf newtimebuf;
        struct utimbuf *newtime = NULL;
@@ -575,8 +574,7 @@ PHP_FUNCTION(touch)
        }
 
        /* create the file if it doesn't exist already */
-       ret = VCWD_STAT(Z_STRVAL_PP(filename), &sb);
-       if (ret == -1) {
+       if (VCWD_ACCESS(Z_STRVAL_PP(filename), F_OK) != 0) {
                file = VCWD_FOPEN(Z_STRVAL_PP(filename), "w");
                if (file == NULL) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create file %s because %s", Z_STRVAL_PP(filename), strerror(errno));