www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Elkins <...@chesapeake.com>
Subject os-windows/2317: Current Working Directory of CGI executable is C:\WINNT\system32
Date Fri, 29 May 1998 15:37:23 GMT

>Number:         2317
>Category:       os-windows
>Synopsis:       Current Working Directory of CGI executable is C:\WINNT\system32
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri May 29 08:40:00 PDT 1998
>Originator:     gfe@chesapeake.com
>Release:        1.3b7
NT Workstation 4 Service Pack 3

Cannot run a CGI executable in 1.3b7, which works in 1.3b6, due to the
CGI executable starting up with Current Working Directory
being C:\WINNT\system32.  In 1.3b6 the Current Working Directory was the
cgi-bin directory where the CGI executable is located.

The CGI executable does an fopen() with relative path to open a
needed configuration file, which is no longer found due to CWD
being different.

if (! (cfile = fopen("mimiweb.cnf", "r"))) {
   char currentpath[128], errormsg[512];
   getcwd(currentpath, 128);
    (errormsg, "Could not open configuration file: getcwd()=\"%s\"", currentpath);
   errorh(cgiOut, errormsg);
   return 0;
Compile a simple CGI executable which just prints out the CWD and
exits, and note the difference in results between 1.3b6 and 1.3b7.

I haven't tried this in Perl (since I don't have that in NT),
but maybe this is the simplest way to repeat the problem.
Use a Win32 thread-safe way of setting current working directory
to where the CGI executable is loaded.
[In order for any reply to be added to the PR database, ]
[you need to include <apbugs@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]

View raw message