From b9f233dec34a0407510325dd8aa4dcad1e79ecc7 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Thu, 21 Dec 2000 16:25:44 +0000 Subject: [PATCH] Allow the server to run in the bin/ subdirectory, and back up over the bin/ directory when determining the Win32 ServerRoot. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87495 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/winnt/mpm_winnt.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index a300244de5..6ad24f3441 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1869,28 +1869,29 @@ void winnt_rewrite_args(process_rec *process) * The requested service's (-n) registry ConfigArgs * The WinNT SCM's StartService() args */ - if (!GetModuleFileName(NULL, fnbuf, sizeof(fnbuf))) { - /* WARNING: There is an implict assumption here that the - * executable resides in the ServerRoot! - */ rv = apr_get_os_error(); ap_log_error(APLOG_MARK,APLOG_ERR, rv, NULL, - "Failed to get the running module's file name"); + "Failed to get the path of Apache.exe"); exit(1); } + /* WARNING: There is an implict assumption here that the + * executable resides in ServerRoot or ServerRoot\bin + */ def_server_root = (char *) apr_filename_of_pathname(fnbuf); if (def_server_root > fnbuf) { *(def_server_root - 1) = '\0'; - def_server_root = ap_os_canonical_filename(process->pool, fnbuf); + def_server_root = (char *) apr_filename_of_pathname(fnbuf); + if (!strcasecmp(def_server_root, "bin")) + *(def_server_root - 1) = '\0'; } + def_server_root = ap_os_canonical_filename(process->pool, fnbuf); /* Use process->pool so that the rewritten argv * lasts for the lifetime of the server process, * because pconf will be destroyed after the * initial pre-flight of the config parser. */ - mpm_new_argv = apr_make_array(process->pool, process->argc + 2, sizeof(const char *)); *(const char **)apr_push_array(mpm_new_argv) = process->argv[0]; @@ -1989,11 +1990,11 @@ void winnt_rewrite_args(process_rec *process) "Using ConfigArgs of the installed service " "\"%s\".", display_name); } - else { + else { ap_log_error(APLOG_MARK,APLOG_INFO, rv, NULL, "No installed ConfigArgs for the service " "\"%s\", using Apache defaults.", display_name); - } + } } else { -- 2.50.1