Re: cvs: php4 /ext/standard file.c
| From: | Zeev Suraski | Date: | Fri, 22 Dec 2000 18:36:59 +0000 |
| Subject: | Re: cvs: php4 /ext/standard file.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-3243@lists.php.net to get a copy of this message | ||
That's what I said in the subsequent letter.
I tend to believe that this code is correct, for one main reason - the guy who wrote it has more real-world experience than all three of us combined times 2.
Monty?
Zeev
At 20:29 22/12/2000, Sascha Schumann wrote:
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.-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/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