Commit 0784677f authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  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
parent 32679001
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -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];