Mailing List Archive

[Bug 53131] New: apr_file_write() incorrectly used

Bug #: 53131
Summary: apr_file_write() incorrectly used
Product: Apache httpd-2
Version: 2.5-HEAD
Platform: PC
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: All
Classification: Unclassified

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:
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:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail: