From: Shane Caraveo Date: Sun, 27 Oct 2002 23:01:45 +0000 (+0000) Subject: fix Bug #20126 X-Git-Tag: php-4.3.0RC1~507 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb55b3a4206abd9864cde7d6aacd4c39033f4927;p=php fix Bug #20126 write returns an int, with < 0 being a failure. --- diff --git a/main/streams.c b/main/streams.c index edeab0488b..77b80353ff 100755 --- a/main/streams.c +++ b/main/streams.c @@ -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