bugzilla at apache
Apr 22, 2012, 9:46 PM
Post #1 of 1
[Bug 53131] New: apr_file_write() incorrectly used
Bug #: 53131
Summary: apr_file_write() incorrectly used
Product: Apache httpd-2
AssignedTo: bugs [at] httpd
ReportedBy: apache [at] viennot
In most cases, developers assume that when apr_file_write() returns
APR_SUCCESS, everything went well, and move on.
In reality, apr_file_write() returns APR_SUCCESS if *some* bytes got written
successfully. One of the many cases when this could happen is when the server
receive a signal in the middle of the write() system call. The kernel will not
return -EINTR, but the number of bytes that have been written so far. The
caller needs to check that all the bytes to write have been successfully
written. This is more or less implemented by apr_file_write_full().
I wrote a fix for mod_log_config because log file corruption is sad.
Patch is here: https://github.com/nviennot/apache-httpd/commit/fcbc7ed94
Note: flush_log() returns void, albeit apr_file_write_full() may fail.
This issue is present in different part of the code base. Following a list of
highly suspicious calls:
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd