Index: os/win32/util_win32.c =================================================================== --- os/win32/util_win32.c (revision 1092396) +++ os/win32/util_win32.c (working copy) @@ -20,6 +20,7 @@ #include "httpd.h" #include "http_log.h" +#include "ap_mpm.h" #include #include @@ -105,7 +106,7 @@ /* To share the semaphores with other processes, we need a NULL ACL * Code from MS KB Q106387 */ -PSECURITY_ATTRIBUTES GetNullACL() +PSECURITY_ATTRIBUTES GetNullACL(void) { PSECURITY_DESCRIPTOR pSD; PSECURITY_ATTRIBUTES sa; Index: os/win32/ap_regkey.c =================================================================== --- os/win32/ap_regkey.c (revision 1092396) +++ os/win32/ap_regkey.c (working copy) @@ -43,7 +43,7 @@ } -apr_status_t regkey_cleanup(void *key) +static apr_status_t regkey_cleanup(void *key) { ap_regkey_t *regkey = key; @@ -363,7 +363,7 @@ else if (valuelen) return APR_ENAMETOOLONG; /* Read to NULL buffer to determine value size */ - rc = RegQueryValueExW(key->hkey, wvalname, 0, resulttype, + rc = RegQueryValueExW(key->hkey, wvalname, 0, (LPDWORD)resulttype, NULL, (LPDWORD)resultsize); if (rc != ERROR_SUCCESS) { return APR_FROM_OS_ERROR(rc); @@ -371,7 +371,7 @@ /* Read value based on size query above */ *result = apr_palloc(pool, *resultsize); - rc = RegQueryValueExW(key->hkey, wvalname, 0, resulttype, + rc = RegQueryValueExW(key->hkey, wvalname, 0, (LPDWORD)resulttype, (LPBYTE)*result, (LPDWORD)resultsize); } #endif /* APR_HAS_UNICODE_FS */ @@ -379,14 +379,14 @@ ELSE_WIN_OS_IS_ANSI { /* Read to NULL buffer to determine value size */ - rc = RegQueryValueEx(key->hkey, valuename, 0, resulttype, + rc = RegQueryValueEx(key->hkey, valuename, 0, (LPDWORD)resulttype, NULL, (LPDWORD)resultsize); if (rc != ERROR_SUCCESS) return APR_FROM_OS_ERROR(rc); /* Read value based on size query above */ *result = apr_palloc(pool, *resultsize); - rc = RegQueryValueEx(key->hkey, valuename, 0, resulttype, + rc = RegQueryValueEx(key->hkey, valuename, 0, (LPDWORD)resulttype, (LPBYTE)*result, (LPDWORD)resultsize); if (rc != ERROR_SUCCESS) return APR_FROM_OS_ERROR(rc); @@ -452,7 +452,7 @@ void *value; char *buf; char *tmp; - DWORD type; + apr_int32_t type; apr_size_t size = 0; rv = ap_regkey_value_raw_get(&value, &size, &type, key, valuename, pool); @@ -468,8 +468,6 @@ { apr_size_t alloclen; apr_size_t valuelen = strlen(valuename) + 1; - apr_size_t wvallen = 256; - apr_wchar_t *wvalue = (apr_wchar_t *)value; /* ###: deliberately overallocate plus two extra nulls. * We could precalculate the exact buffer here instead, the question Index: os/win32/os.h =================================================================== --- os/win32/os.h (revision 1092396) +++ os/win32/os.h (working copy) @@ -85,7 +85,7 @@ FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char* fnName, int ordinal); -PSECURITY_ATTRIBUTES GetNullACL(); +PSECURITY_ATTRIBUTES GetNullACL(void); void CleanNullACL(void *sa); int set_listeners_noninheritable(apr_pool_t *p); Index: server/mpm/winnt/service.c =================================================================== --- server/mpm/winnt/service.c (revision 1092396) +++ server/mpm/winnt/service.c (working copy) @@ -34,6 +34,7 @@ #endif #undef _WINUSER_ #include +#include static char *mpm_service_name = NULL; static char *mpm_display_name = NULL; @@ -52,42 +53,6 @@ static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint); -#define PRODREGKEY "SOFTWARE\\" AP_SERVER_BASEVENDOR "\\" \ - AP_SERVER_BASEPRODUCT "\\" AP_SERVER_BASEREVISION - -/* - * Get the server root from the registry into 'dir' which is - * size bytes long. Returns 0 if the server root was found - * or if the serverroot key does not exist (in which case - * dir will contain an empty string), or -1 if there was - * an error getting the key. - */ -apr_status_t ap_registry_get_server_root(apr_pool_t *p, char **buf) -{ - apr_status_t rv; - ap_regkey_t *key; - - if ((rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, PRODREGKEY, - APR_READ, p)) == APR_SUCCESS) { - rv = ap_regkey_value_get(buf, key, "ServerRoot", p); - ap_regkey_close(key); - if (rv == APR_SUCCESS) - return rv; - } - - if ((rv = ap_regkey_open(&key, AP_REGKEY_CURRENT_USER, PRODREGKEY, - APR_READ, p)) == APR_SUCCESS) { - rv = ap_regkey_value_get(buf, key, "ServerRoot", p); - ap_regkey_close(key); - if (rv == APR_SUCCESS) - return rv; - } - - *buf = NULL; - return rv; -} - - /* The service configuration's is stored under the following trees: * * HKLM\System\CurrentControlSet\Services\[service name] @@ -157,7 +122,8 @@ return; } remains = ((start + 30) - time(NULL)); - sprintf (count, "%d...", remains); + sprintf(count, "%d...", + (int)remains); /* 30 or less, so can't overflow int */ if (!SetConsoleCursorPosition(hConErr, coninfo.dwCursorPosition)) return; if (!WriteConsole(hConErr, count, (DWORD)strlen(count), &result, NULL) @@ -427,7 +393,6 @@ { const char *full_description; SC_HANDLE schSCManager; - BOOL ret = 0; /* Nothing to do if we are a console */ @@ -565,7 +530,7 @@ } -DWORD WINAPI service_nt_dispatch_thread(LPVOID nada) +static DWORD WINAPI service_nt_dispatch_thread(LPVOID nada) { apr_status_t rv = APR_SUCCESS; @@ -675,7 +640,7 @@ } -void service_stopped(void) +static void service_stopped(void) { /* Still have a thread & window to clean up, so signal now */ if (globdat.service_thread) @@ -1075,7 +1040,7 @@ if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { - char **start_argv; + const CHAR **start_argv; SC_HANDLE schService; SC_HANDLE schSCManager; Index: server/mpm/winnt/child.c =================================================================== --- server/mpm/winnt/child.c (revision 1092396) +++ server/mpm/winnt/child.c (working copy) @@ -39,6 +39,8 @@ #include #include "apr_atomic.h" +#include + #ifdef __MINGW32__ #include #endif @@ -67,8 +69,8 @@ static apr_thread_mutex_t *qlock; static PCOMP_CONTEXT qhead = NULL; static PCOMP_CONTEXT qtail = NULL; -static int num_completion_contexts = 0; -static int max_num_completion_contexts = 0; +static apr_uint32_t num_completion_contexts = 0; +static apr_uint32_t max_num_completion_contexts = 0; static HANDLE ThreadDispatchIOCP = NULL; static HANDLE qwait_event = NULL; @@ -354,7 +356,7 @@ apr_os_sock_get(&nsd, lr->sd); FD_SET(nsd, &listenfds); ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, - "Child %d: Listening on port %d.", my_pid, lr->bind_addr->port); + "Child %lu: Listening on port %d.", my_pid, lr->bind_addr->port); } } @@ -514,7 +516,7 @@ #endif ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, - "Child %d: Starting thread to listen on port %d.", my_pid, lr->bind_addr->port); + "Child %lu: Starting thread to listen on port %d.", my_pid, lr->bind_addr->port); while (!shutdown_in_progress) { if (!context) { context = mpm_get_completion_context(); @@ -582,7 +584,7 @@ context->accept_socket = INVALID_SOCKET; if (err_count > MAX_ACCEPTEX_ERR_COUNT) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, - "Child %d: Encountered too many errors accepting client connections. " + "Child %lu: Encountered too many errors accepting client connections. " "Possible causes: dynamic address renewal, or incompatible VPN or firewall software. " "Try using the Win32DisableAcceptEx directive.", my_pid); err_count = 0; @@ -594,7 +596,7 @@ ++err_count; if (err_count > MAX_ACCEPTEX_ERR_COUNT) { ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf, - "Child %d: Encountered too many errors accepting client connections. " + "Child %lu: Encountered too many errors accepting client connections. " "Possible causes: Unknown. " "Try using the Win32DisableAcceptEx directive.", my_pid); err_count = 0; @@ -680,7 +682,7 @@ SetEvent(exit_event); } ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, ap_server_conf, - "Child %d: Accept thread exiting.", my_pid); + "Child %lu: Accept thread exiting.", my_pid); return 0; } @@ -709,7 +711,7 @@ if (!rc) { rc = apr_get_os_error(); ap_log_error(APLOG_MARK,APLOG_DEBUG, rc, ap_server_conf, - "Child %d: GetQueuedComplationStatus returned %d", my_pid, rc); + "Child %lu: GetQueuedComplationStatus returned %d", my_pid, rc); continue; } @@ -826,9 +828,9 @@ * monitors the child process for maintenance and shutdown * events. */ -static void create_listener_thread() +static void create_listener_thread(void) { - int tid; + unsigned tid; int num_listeners = 0; if (!use_acceptex) { _beginthreadex(NULL, 0, win9x_accept, @@ -874,7 +876,7 @@ int watch_thread; int time_remains; int cld; - int tid; + unsigned tid; int rv; int i; @@ -888,7 +890,7 @@ max_requests_per_child_event = CreateEvent(NULL, TRUE, FALSE, NULL); if (!max_requests_per_child_event) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: Failed to create a max_requests event.", my_pid); + "Child %lu: Failed to create a max_requests event.", my_pid); exit(APEXIT_CHILDINIT); } child_events[0] = exit_event; @@ -906,11 +908,11 @@ status = apr_proc_mutex_lock(start_mutex); if (status != APR_SUCCESS) { ap_log_error(APLOG_MARK,APLOG_ERR, status, ap_server_conf, - "Child %d: Failed to acquire the start_mutex. Process will exit.", my_pid); + "Child %lu: Failed to acquire the start_mutex. Process will exit.", my_pid); exit(APEXIT_CHILDINIT); } ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Acquired the start mutex.", my_pid); + "Child %lu: Acquired the start mutex.", my_pid); /* * Create the worker thread dispatch IOCompletionPort @@ -926,7 +928,7 @@ qwait_event = CreateEvent(NULL, TRUE, FALSE, NULL); if (!qwait_event) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: Failed to create a qwait event.", my_pid); + "Child %lu: Failed to create a qwait event.", my_pid); exit(APEXIT_CHILDINIT); } } @@ -935,7 +937,7 @@ * Create the pool of worker threads */ ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Starting %d worker threads.", my_pid, ap_threads_per_child); + "Child %lu: Starting %d worker threads.", my_pid, ap_threads_per_child); child_handles = (HANDLE) apr_pcalloc(pchild, ap_threads_per_child * sizeof(HANDLE)); apr_thread_mutex_create(&child_lock, APR_THREAD_MUTEX_DEFAULT, pchild); @@ -951,7 +953,7 @@ worker_main, (void *) i, 0, &tid); if (child_handles[i] == 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: _beginthreadex failed. Unable to create all worker threads. " + "Child %lu: _beginthreadex failed. Unable to create all worker threads. " "Created %d of the %d threads requested with the ThreadsPerChild configuration directive.", my_pid, threads_created, ap_threads_per_child); ap_signal_parent(SIGNAL_PARENT_SHUTDOWN); @@ -1023,13 +1025,13 @@ if (rv == WAIT_FAILED) { /* Something serious is wrong */ ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: WAIT_FAILED -- shutting down server", my_pid); + "Child %lu: WAIT_FAILED -- shutting down server", my_pid); break; } else if (cld == 0) { /* Exit event was signaled */ ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Exit event signaled. Child process is ending.", my_pid); + "Child %lu: Exit event signaled. Child process is ending.", my_pid); break; } else { @@ -1037,7 +1039,7 @@ * Signal the parent to restart */ ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Process exiting because it reached " + "Child %lu: Process exiting because it reached " "MaxRequestsPerChild. Signaling the parent to " "restart a new child process.", my_pid); ap_signal_parent(SIGNAL_PARENT_RESTART); @@ -1082,11 +1084,11 @@ rv = apr_proc_mutex_unlock(start_mutex); if (rv == APR_SUCCESS) { ap_log_error(APLOG_MARK,APLOG_NOTICE, rv, ap_server_conf, - "Child %d: Released the start mutex", my_pid); + "Child %lu: Released the start mutex", my_pid); } else { ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf, - "Child %d: Failure releasing the start mutex", my_pid); + "Child %lu: Failure releasing the start mutex", my_pid); } /* Shutdown the worker threads */ @@ -1099,7 +1101,7 @@ /* Post worker threads blocked on the ThreadDispatch IOCompletion port */ while (g_blocked_threads > 0) { ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, ap_server_conf, - "Child %d: %d threads blocked on the completion port", my_pid, g_blocked_threads); + "Child %lu: %d threads blocked on the completion port", my_pid, g_blocked_threads); for (i=g_blocked_threads; i > 0; i--) { PostQueuedCompletionStatus(ThreadDispatchIOCP, 0, IOCP_SHUTDOWN, NULL); } @@ -1139,7 +1141,7 @@ if ((time_remains % 30000) == 0) { ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Waiting %d more seconds " + "Child %lu: Waiting %d more seconds " "for %d worker threads to finish.", my_pid, time_remains / 1000, threads_created); } @@ -1183,7 +1185,7 @@ /* Kill remaining threads off the hard way */ if (threads_created) { ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Terminating %d threads that failed to exit.", + "Child %lu: Terminating %d threads that failed to exit.", my_pid, threads_created); } for (i = 0; i < threads_created; i++) { @@ -1198,7 +1200,7 @@ } } ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: All worker threads have exited.", my_pid); + "Child %lu: All worker threads have exited.", my_pid); CloseHandle(allowed_globals.jobsemaphore); apr_thread_mutex_destroy(allowed_globals.jobmutex); Index: server/mpm/winnt/nt_eventlog.c =================================================================== --- server/mpm/winnt/nt_eventlog.c (revision 1092396) +++ server/mpm/winnt/nt_eventlog.c (working copy) @@ -24,7 +24,7 @@ #include "apr_portable.h" #include "ap_regkey.h" -static char *display_name = NULL; +static const char *display_name = NULL; static HANDLE stderr_thread = NULL; static HANDLE stderr_ready; @@ -101,7 +101,7 @@ if ((errres = GetLastError()) != ERROR_BROKEN_PIPE) { apr_snprintf(errbuf, sizeof(errbuf), - "Win32 error %d reading stderr pipe stream\r\n", + "Win32 error %lu reading stderr pipe stream\r\n", GetLastError()); ReportEvent(hEventSource, EVENTLOG_ERROR_TYPE, 0, @@ -131,13 +131,11 @@ } -void mpm_nt_eventlog_stderr_open(char *argv0, apr_pool_t *p) +void mpm_nt_eventlog_stderr_open(const char *argv0, apr_pool_t *p) { SECURITY_ATTRIBUTES sa; - HANDLE hProc = GetCurrentProcess(); HANDLE hPipeRead = NULL; HANDLE hPipeWrite = NULL; - HANDLE hDup = NULL; DWORD threadid; apr_file_t *eventlog_file; apr_file_t *stderr_file; Index: server/mpm/winnt/mpm_winnt.c =================================================================== --- server/mpm/winnt/mpm_winnt.c (revision 1092396) +++ server/mpm/winnt/mpm_winnt.c (working copy) @@ -102,30 +102,11 @@ */ static HANDLE pipe; -/* Stub functions until this MPM supports the connection status API */ - -AP_DECLARE(void) ap_update_connection_status(long conn_id, const char *key, \ - const char *value) -{ - /* NOP */ -} - -AP_DECLARE(void) ap_reset_connection_status(long conn_id) -{ - /* NOP */ -} - -AP_DECLARE(apr_array_header_t *) ap_get_status_table(apr_pool_t *p) -{ - /* NOP */ - return NULL; -} - /* * Command processors */ -static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg) +static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -191,7 +172,7 @@ } return NULL; } -static const char *set_disable_acceptex(cmd_parms *cmd, void *dummy, char *arg) +static const char *set_disable_acceptex(cmd_parms *cmd, void *dummy) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -340,9 +321,9 @@ * start mutex [signal from the parent to begin accept()] * scoreboard shm handle [to recreate the ap_scoreboard] */ -void get_handles_from_parent(server_rec *s, HANDLE *child_exit_event, - apr_proc_mutex_t **child_start_mutex, - apr_shm_t **scoreboard_shm) +static void get_handles_from_parent(server_rec *s, HANDLE *child_exit_event, + apr_proc_mutex_t **child_start_mutex, + apr_shm_t **scoreboard_shm) { HANDLE hScore; HANDLE ready_event; @@ -358,7 +339,7 @@ &BytesRead, (LPOVERLAPPED) NULL) || (BytesRead != sizeof(HANDLE))) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: Unable to retrieve the ready event from the parent", my_pid); + "Child %lu: Unable to retrieve the ready event from the parent", my_pid); exit(APEXIT_CHILDINIT); } @@ -369,7 +350,7 @@ &BytesRead, (LPOVERLAPPED) NULL) || (BytesRead != sizeof(HANDLE))) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: Unable to retrieve the exit event from the parent", my_pid); + "Child %lu: Unable to retrieve the exit event from the parent", my_pid); exit(APEXIT_CHILDINIT); } @@ -377,14 +358,14 @@ &BytesRead, (LPOVERLAPPED) NULL) || (BytesRead != sizeof(os_start))) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: Unable to retrieve the start_mutex from the parent", my_pid); + "Child %lu: Unable to retrieve the start_mutex from the parent", my_pid); exit(APEXIT_CHILDINIT); } *child_start_mutex = NULL; if ((rv = apr_os_proc_mutex_put(child_start_mutex, &os_start, s->process->pool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, - "Child %d: Unable to access the start_mutex from the parent", my_pid); + "Child %lu: Unable to access the start_mutex from the parent", my_pid); exit(APEXIT_CHILDINIT); } @@ -392,21 +373,21 @@ &BytesRead, (LPOVERLAPPED) NULL) || (BytesRead != sizeof(hScore))) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, - "Child %d: Unable to retrieve the scoreboard from the parent", my_pid); + "Child %lu: Unable to retrieve the scoreboard from the parent", my_pid); exit(APEXIT_CHILDINIT); } *scoreboard_shm = NULL; if ((rv = apr_os_shm_put(scoreboard_shm, &hScore, s->process->pool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, - "Child %d: Unable to access the scoreboard from the parent", my_pid); + "Child %lu: Unable to access the scoreboard from the parent", my_pid); exit(APEXIT_CHILDINIT); } rv = ap_reopen_scoreboard(s->process->pool, scoreboard_shm, 1); if (rv || !(sb_shared = apr_shm_baseaddr_get(*scoreboard_shm))) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, - "Child %d: Unable to reopen the scoreboard from the parent", my_pid); + "Child %lu: Unable to reopen the scoreboard from the parent", my_pid); exit(APEXIT_CHILDINIT); } /* We must 'initialize' the scoreboard to relink all the @@ -415,7 +396,7 @@ ap_init_scoreboard(sb_shared); ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, - "Child %d: Retrieved our scoreboard from the parent.", my_pid); + "Child %lu: Retrieved our scoreboard from the parent.", my_pid); } @@ -505,7 +486,7 @@ * exclusively in the child process, receives them from the parent and * makes them availeble in the child. */ -void get_listeners_from_parent(server_rec *s) +static void get_listeners_from_parent(server_rec *s) { WSAPROTOCOL_INFO WSAProtocolInfo; ap_listen_rec *lr; @@ -539,7 +520,7 @@ &WSAProtocolInfo, 0, 0); if (nsd == INVALID_SOCKET) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_netos_error(), ap_server_conf, - "Child %d: setup_inherited_listeners(), WSASocket failed to open the inherited socket.", my_pid); + "Child %lu: setup_inherited_listeners(), WSASocket failed to open the inherited socket.", my_pid); exit(APEXIT_CHILDINIT); } @@ -571,7 +552,7 @@ } ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, - "Child %d: retrieved %d listeners from parent", my_pid, lcnt); + "Child %lu: retrieved %d listeners from parent", my_pid, lcnt); } @@ -591,14 +572,14 @@ for (lr = ap_listeners; lr; lr = lr->next, ++lcnt) { apr_os_sock_t nsd; lpWSAProtocolInfo = apr_pcalloc(p, sizeof(WSAPROTOCOL_INFO)); - apr_os_sock_get(&nsd,lr->sd); + apr_os_sock_get(&nsd, lr->sd); ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, ap_server_conf, - "Parent: Duplicating socket %d and sending it to child process %d", + "Parent: Duplicating socket %d and sending it to child process %lu", nsd, dwProcessId); if (WSADuplicateSocket(nsd, dwProcessId, lpWSAProtocolInfo) == SOCKET_ERROR) { ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_netos_error(), ap_server_conf, - "Parent: WSADuplicateSocket failed for socket %d. Check the FAQ.", lr->sd ); + "Parent: WSADuplicateSocket failed for socket %d. Check the FAQ.", nsd); return -1; } @@ -606,13 +587,13 @@ sizeof(WSAPROTOCOL_INFO), &BytesWritten)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, - "Parent: Unable to write duplicated socket %d to the child.", lr->sd ); + "Parent: Unable to write duplicated socket %d to the child.", nsd); return -1; } } ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, - "Parent: Sent %d listeners to child %d", lcnt, dwProcessId); + "Parent: Sent %d listeners to child %lu", lcnt, dwProcessId); return 0; } @@ -731,11 +712,12 @@ } env = apr_palloc(ptemp, (envc + 2) * sizeof (char*)); memcpy(env, _environ, envc * sizeof (char*)); - apr_snprintf(pidbuf, sizeof(pidbuf), "AP_PARENT_PID=%i", parent_pid); + apr_snprintf(pidbuf, sizeof(pidbuf), "AP_PARENT_PID=%lu", parent_pid); env[envc] = pidbuf; env[envc + 1] = NULL; - rv = apr_proc_create(&new_child, cmd, args, env, attr, ptemp); + rv = apr_proc_create(&new_child, cmd, (const char * const *)args, + (const char * const *)env, attr, ptemp); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, "Parent: Failed to create the child process."); @@ -924,7 +906,7 @@ } if (SetEvent(child_exit_event) == 0) { ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s, - "Parent: SetEvent for child process %d failed.", + "Parent: SetEvent for child process %pp failed.", event_handles[CHILD_HANDLE]); } /* Don't wait to verify that the child process really exits, @@ -944,14 +926,14 @@ || exitcode == APEXIT_CHILDINIT || exitcode == APEXIT_INIT) { ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf, - "Parent: child process exited with status %u -- Aborting.", exitcode); + "Parent: child process exited with status %lu -- Aborting.", exitcode); shutdown_pending = 1; } else { int i; restart_pending = 1; ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Parent: child process exited with status %u -- Restarting.", exitcode); + "Parent: child process exited with status %lu -- Restarting.", exitcode); for (i = 0; i < ap_threads_per_child; i++) { ap_update_child_status_from_indexes(0, i, SERVER_DEAD, NULL); } @@ -979,7 +961,8 @@ /* Signal the child processes to exit */ if (SetEvent(child_exit_event) == 0) { ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), ap_server_conf, - "Parent: SetEvent for child process %d failed", event_handles[CHILD_HANDLE]); + "Parent: SetEvent for child process %pp failed", + event_handles[CHILD_HANDLE]); } if (event_handles[CHILD_HANDLE]) { rv = WaitForSingleObject(event_handles[CHILD_HANDLE], timeout); @@ -991,7 +974,8 @@ } else { ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Parent: Forcing termination of child process %d ", event_handles[CHILD_HANDLE]); + "Parent: Forcing termination of child process %pp", + event_handles[CHILD_HANDLE]); TerminateProcess(event_handles[CHILD_HANDLE], 1); CloseHandle(event_handles[CHILD_HANDLE]); event_handles[CHILD_HANDLE] = NULL; @@ -1066,9 +1050,9 @@ static apr_status_t service_to_start_success; static int inst_argc; static const char * const *inst_argv; -static char *service_name = NULL; +static const char *service_name = NULL; -void winnt_rewrite_args(process_rec *process) +static void winnt_rewrite_args(process_rec *process) { /* Handle the following SCM aspects in this phase: * @@ -1208,7 +1192,7 @@ optbuf[0] = '-'; optbuf[2] = '\0'; - apr_getopt_init(&opt, process->pool, process->argc, (char**) process->argv); + apr_getopt_init(&opt, process->pool, process->argc, process->argv); opt->errfn = NULL; while ((rv = apr_getopt(opt, "wn:k:" AP_SERVER_BASEARGS, optbuf + 1, &optarg)) == APR_SUCCESS) { @@ -1532,7 +1516,7 @@ * across a restart */ PSECURITY_ATTRIBUTES sa = GetNullACL(); /* returns NULL if invalid (Win95?) */ - setup_signal_names(apr_psprintf(pconf,"ap%d", parent_pid)); + setup_signal_names(apr_psprintf(pconf,"ap%lu", parent_pid)); ap_log_pid(pconf, ap_pid_fname); @@ -1644,7 +1628,7 @@ { apr_status_t rv; - setup_signal_names(apr_psprintf(pchild,"ap%d", parent_pid)); + setup_signal_names(apr_psprintf(pchild,"ap%lu", parent_pid)); /* This is a child process, not in single process mode */ if (!one_process) { @@ -1666,7 +1650,7 @@ APR_LOCK_DEFAULT, s->process->pool); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf, - "%s child %d: Unable to init the start_mutex.", + "%s child %lu: Unable to init the start_mutex.", service_name, my_pid); exit(APEXIT_CHILDINIT); } @@ -1709,12 +1693,12 @@ /* The child process or in one_process (debug) mode */ ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Child process is running", my_pid); + "Child %lu: Child process is running", my_pid); child_main(pconf); ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, - "Child %d: Child process is exiting", my_pid); + "Child %lu: Child process is exiting", my_pid); return 1; } else Index: server/mpm/winnt/mpm_winnt.h =================================================================== --- server/mpm/winnt/mpm_winnt.h (revision 1092396) +++ server/mpm/winnt/mpm_winnt.h (working copy) @@ -62,7 +62,7 @@ /* From nt_eventlog.c: */ -void mpm_nt_eventlog_stderr_open(char *display_name, apr_pool_t *p); +void mpm_nt_eventlog_stderr_open(const char *display_name, apr_pool_t *p); void mpm_nt_eventlog_stderr_flush(void); /* From winnt.c: */ @@ -126,5 +126,9 @@ void mpm_recycle_completion_context(PCOMP_CONTEXT pCompContext); apr_status_t mpm_post_completion_context(PCOMP_CONTEXT pCompContext, io_state_e state); void hold_console_open_on_error(void); + +/* From child.c: */ +void child_main(apr_pool_t *pconf); + #endif /* APACHE_MPM_WINNT_H */ /** @} */ Index: server/util_script.c =================================================================== --- server/util_script.c (revision 1092396) +++ server/util_script.c (working copy) @@ -187,16 +187,16 @@ apr_table_addn(e, "PATH", apr_pstrdup(r->pool, env_path)); #ifdef WIN32 - if (env_temp = getenv("SystemRoot")) { + if ((env_temp = getenv("SystemRoot")) != NULL) { apr_table_addn(e, "SystemRoot", env_temp); } - if (env_temp = getenv("COMSPEC")) { + if ((env_temp = getenv("COMSPEC")) != NULL) { apr_table_addn(e, "COMSPEC", env_temp); } - if (env_temp = getenv("PATHEXT")) { + if ((env_temp = getenv("PATHEXT")) != NULL) { apr_table_addn(e, "PATHEXT", env_temp); } - if (env_temp = getenv("WINDIR")) { + if ((env_temp = getenv("WINDIR")) != NULL) { apr_table_addn(e, "WINDIR", env_temp); } #endif