]> granicus.if.org Git - php/commitdiff
fix Bug #20126
authorShane Caraveo <shane@php.net>
Sun, 27 Oct 2002 23:01:45 +0000 (23:01 +0000)
committerShane Caraveo <shane@php.net>
Sun, 27 Oct 2002 23:01:45 +0000 (23:01 +0000)
write returns an int, with < 0 being a failure.

main/streams.c

index edeab0488be8dc5ecbc8c02ed0a057cf9583cd17..77b80353ff8cecd17720f7625e7072896a43295c 100755 (executable)
@@ -1260,9 +1260,9 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count
        assert(data != NULL);
 
        if (data->fd >= 0) {
-               
-               return write(data->fd, buf, count);
-
+               int bytes_written = write(data->fd, buf, count);
+               if (bytes_written < 0) return 0;
+               return (size_t) bytes_written;
        } else {
 
 #if HAVE_FLUSHIO