The current aplog_error() function cannot report on errors returned by
Win32 functions. These functions do not bother setting errno - instead,
you have to make a call to GetLastError() to get the error code, then call
FormatMessage() to get the corresponding string. I already added code to
do this in os/win32/service.c, but this was specific to reporting errors
to standard error during apache -i or -u calls.
The patch below updates aplog_error() to enable generic logging of
Win32 errors to the same place as other errors. It adds a new flag,
APLOG_WIN32ERROR which if given in the _second_ argument to aplog_error()
causes the Win32 error code and error string to be logged. Here is an
example call (this is from worker_main()):
if (SetEvent(ev[i]) == 0)
aplog_error(APLOG_MARK,APLOG_WIN32ERROR, server_conf,
"SetEvent for child process in slot #%d", i);
Reviewed by: Ben Laurie, Martin Kraemer
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@79673 13f79535-47bb-0310-9956-ffa450edef68
Loading
Please sign in to comment