]> granicus.if.org Git - apache/commitdiff
Eliminate GetModuleFileName()
authorWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 1 Jul 2002 18:24:54 +0000 (18:24 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 1 Jul 2002 18:24:54 +0000 (18:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95931 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/mpm_winnt.c

index c695d437587b80265ac6bc3171e8bff68ef4a2b7..868c73a9bb8bdab972622281a7f64898a296ac56 100644 (file)
@@ -2002,7 +2002,7 @@ void winnt_rewrite_args(process_rec *process)
      */
     apr_status_t rv;
     char *def_server_root;
-    char fnbuf[MAX_PATH];
+    char *binpath;
     char optbuf[3];
     const char *optarg;
     int fixed_args;
@@ -2054,23 +2054,23 @@ 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))) {
-        rv = apr_get_os_error();
+    if ((rv = ap_os_proc_filepath(&binpath, process->pconf))
+            != APR_SUCCESS) {
         ap_log_error(APLOG_MARK,APLOG_CRIT, rv, NULL, 
-                     "Failed to get the path of Apache.exe");
+                     "Failed to get the full path of %s", process->argv[0]);
         exit(APEXIT_INIT);
     }
     /* 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 = (char *) apr_filename_of_pathname(binpath);
+    if (def_server_root > binpath) {
         *(def_server_root - 1) = '\0';
-        def_server_root = (char *) apr_filename_of_pathname(fnbuf);
+        def_server_root = (char *) apr_filename_of_pathname(binpath);
         if (!strcasecmp(def_server_root, "bin"))
             *(def_server_root - 1) = '\0';
     }
-    apr_filepath_merge(&def_server_root, NULL, fnbuf
+    apr_filepath_merge(&def_server_root, NULL, binpath
                        APR_FILEPATH_TRUENAME, process->pool);
 
     /* Use process->pool so that the rewritten argv