diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-05-19 02:51:00 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-05-19 02:51:00 +0000 |
commit | 95875d996661369faa2647846c8168fed625a961 (patch) | |
tree | 4712aebd3077df01d29f99800d14265d79d06d04 /ext/standard/filestat.c | |
parent | 55041d6f3d17a8e505e7cdcfdb1256fcc31a0cb7 (diff) | |
download | php-git-95875d996661369faa2647846c8168fed625a961.tar.gz |
Fixed bug #37505 (touch() truncates large files).
Diffstat (limited to 'ext/standard/filestat.c')
-rw-r--r-- | ext/standard/filestat.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 8d40561c51..d19a29f67c 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -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)); |