httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <>
Subject Re: [PATCH libapreq-1.2] Re: [PATCH mp1.28] Clean up file uploaded by test suite
Date Thu, 21 Aug 2003 12:20:09 GMT
Steve Hay <> writes:


> In my case, the default temporary directory used was C:\WINDOWS\Temp,
> but when I tried changing it to C:\Temp via that TEMP_DIR setting, I
> found that it made no difference - the uploaded file still got spooled
> into C:\WINDOWS\Temp. A look at the MS documentation for their
> implementation of the standard C library routine tempnam(), which
> ApacheRequest_tmpfile() uses, says of the first argument, "Target
> directory to be used if TMP not defined".  The "TMP" there is a
> reference to the TMP environment variable.

FWIW, here's what POSIX (v3) says about tempnam():

  char *tempnam(const char *dir, const char *pfx);


  The tempnam() function shall generate a pathname that may be used for
  a temporary file. 

  The tempnam() function allows the user to control the choice of a
  directory. The dir argument points to the name of the directory in which
  the file is to be created. If dir is a null pointer or points to a
  string which is not a name for an appropriate directory, the path prefix
  defined as P_tmpdir in the <stdio.h> header shall be used. If that
  directory is not accessible, an implementation-defined directory may be

It conveniently omits any mention of what should happen if dir
*is* a valid directory name.

> How does tempnam() behave on other OS's?  My K&R makes no mention of
> environment variables coming into play.

glibc's documented behavior for tempnam() is similar to MS's 
(except they use "TMPDIR" instead of "TMP"):

  % man 3 tempnam
    Attempts to find an  appropriate  directory  go through the
    following steps: (i) In case the environment variable TMPDIR exists
    and  contains  the  name  of  an appropriate  directory, that is used.  

> If it's only Windows that behaves this way then I'm happy to provide a DOC
> PATCH to describe this behaviour.


Joe Schaefer

View raw message