You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by George Elkins <gf...@chesapeake.com> on 1998/05/29 17:37:23 UTC
os-windows/2317: Current Working Directory of CGI executable is C:\WINNT\system32
>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
>Last-Modified:
>Originator: gfe@chesapeake.com
>Organization:
apache
>Release: 1.3b7
>Environment:
NT Workstation 4 Service Pack 3
>Description:
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);
sprintf
(errormsg, "Could not open configuration file: getcwd()=\"%s\"", currentpath);
errorh(cgiOut, errormsg);
return 0;
}
>How-To-Repeat:
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.
>Fix:
Use a Win32 thread-safe way of setting current working directory
to where the CGI executable is loaded.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED. This is not done]
[automatically because of the potential for mail loops. ]