]> granicus.if.org Git - php/commitdiff
@Copy() fixed to return 1 on 0 byte files. Patch by Ilia A <ilia@prohost.org>.
authorJames Cox <imajes@php.net>
Fri, 9 Aug 2002 00:33:06 +0000 (00:33 +0000)
committerJames Cox <imajes@php.net>
Fri, 9 Aug 2002 00:33:06 +0000 (00:33 +0000)
main/streams.c

index bec298b269bc151c40cd2a13bac91abce61fdf60..dd77144cbd8ea5e167c14313d42fe44a6852cb9c 100755 (executable)
@@ -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;