httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bh...@gensym.com (Ben Hyde)
Subject chdir isn't thead specific
Date Wed, 06 May 1998 20:34:48 GMT

Re:
  WIN32 1.3 FINAL RELEASE SHOWSTOPPERS:
    * bad use of chdir in some places; it isn't thread-specific

First an enumeration of where chdir is used.

These are not an issue?
  
  include/conf.h:637:#define chdir _chdir2
     Part of the __EMX__ (aka OS/2)
  
  main/http_main.c:2186:    chdir(ap_coredump_dir);
     Part of sig_coredump so not part of the Windows footprint.
  
  main/http_main.c:2428:    chdir("/");
     ifndef WIN32  -- part of detach()
  
  os/win32/service.c:91:    chdir(buf);
     for service_cd() -- intentional
  
  support/suexec.c:408:     * Use chdir()s and getcwd()s to avoid problems with symlinked
  support/suexec.c:417:	if (((chdir(target_homedir)) != 0) ||
  support/suexec.c:418:	    ((chdir(USERDIR_SUFFIX)) != 0) ||
  support/suexec.c:420:	    ((chdir(cwd)) != 0)) {
  support/suexec.c:426:	if (((chdir(DOC_ROOT)) != 0) ||
  support/suexec.c:428:	    ((chdir(cwd)) != 0)) {
    Not on windows?
  
  include/compat.h:66:#define chdir_file                     ap_chdir_file
     Humm...

  main/util.c:495:API_EXPORT(void) ap_chdir_file(const char *file)
  main/util.c:502:	chdir(file);
  main/util.c:507:	chdir(buf);
     All part of ap_chdir_file

These are an issue:
  
  modules/standard/mod_cgi.c:318:    ap_chdir_file(r->filename);
      ap_chdir_file(r->filename);
      if (!cld->debug)
  	ap_error_log2stderr(r->server);
      ap_cleanup_for_exec();
      child_pid = ap_call_exec(r, argv0, env, 0);
  
  modules/standard/mod_include.c:610:    ap_chdir_file(r->filename);
    in include_cgi
  
  modules/standard/mod_include.c:701:            ap_chdir_file(r->filename);
    in handle_include
  
  modules/standard/mod_include.c:847:            ap_chdir_file(r->filename);
  modules/standard/mod_include.c:857:            ap_chdir_file(r->filename);
    in handle_exec
          if (!strcmp(tag, "cmd")) {
              ...
              if (include_cmd(parsed_string, r) == -1) {
  	         ...
              }
              /* just in case some stooge changed directories */
              ap_chdir_file(r->filename);
          }
          else if (!strcmp(tag, "cgi")) {
              ...
              if (include_cgi(parsed_string, r) == -1) {
                ...
              }
              /* grumble groan */
              ap_chdir_file(r->filename);
          }
  
  modules/standard/mod_include.c:2082:    ap_chdir_file(r->filename);
     in send_parsed_content
       ...
       ap_chdir_file(r->filename);
       if (r->args) {
            ...
                     ap_escape_shell_cmd(r->pool, arg_copy) ...
       }
       ...


Second, what to do...

A mutex that owns the current working directory looks necessary.

Revising all the subprocess command execution to take a
directory would also be good.

Thoughts, volunteers?

 - ben hyde


Mime
View raw message