Re: cvs: php4 /ext/standard file.c

From: Date: Fri, 22 Dec 2000 18:29:10 +0000
Subject: Re: cvs: php4 /ext/standard file.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3242@lists.php.net to get a copy of this message
On Fri, 22 Dec 2000, Zeev Suraski wrote: > Take a look at my_write(). It appears to support just about everything, > and it takes care of the problems you stated. We even have it in our > source tree. This code is a good example of the write() API problem. If write() does not return Count, the code assumes that errno was set by write(). If errno was not set by write(), the code will simply take the error code from a previous system call and reinterprete it in this context. That is pretty much wrong, considering the following three paragraphs: (Especially note the absence of errno in the first and third paragraphs.) "If a write() requests that more bytes be written than there is room for (for example, the ulimit or the physical end of a medium), only as many bytes as there is room for will be written. For example, suppose there is space for 20 bytes more in a file before reaching a limit. A write of 512 bytes will return 20. The next write of a non-zero number of bytes will give a failure return (except as noted below) and the implementation will generate a SIGXFSZ signal for the thread. "If write() is interrupted by a signal before it writes any data, it will return -1 with errno set to [EINTR]. "If write() is interrupted by a signal after it successfully writes some data, it will return the number of bytes written. - Sascha

« previous php.cvs (#3242) next »