summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJames Cox <imajes@php.net>2002-08-09 00:33:06 +0000
committerJames Cox <imajes@php.net>2002-08-09 00:33:06 +0000
commit1ae29d455c71f8a1fd329f8850278c249646beed (patch)
tree45f4a6ca2bf9beb2dcbbba472e8178d8458c0d9c /main
parent4097df12c6bdbf2640030f55944f72f6cc04d62c (diff)
downloadphp-git-1ae29d455c71f8a1fd329f8850278c249646beed.tar.gz
@Copy() fixed to return 1 on 0 byte files. Patch by Ilia A <ilia@prohost.org>.
Diffstat (limited to 'main')
-rwxr-xr-xmain/streams.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/streams.c b/main/streams.c
index bec298b269..dd77144cbd 100755
--- a/main/streams.c
+++ b/main/streams.c
@@ -474,6 +474,12 @@ PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size
if (fstat(srcfd, &sbuf) == 0) {
void *srcfile;
+ /* in the event that the source file is 0 bytes, return 1 to indicate success
+ * because opening the file to write had already created a copy */
+
+ if(sbuf.st_size ==0)
+ return 1;
+
if (maxlen > sbuf.st_size || maxlen == 0)
maxlen = sbuf.st_size;