php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #874 tempnam function does not support $TMPDIR overriding
Submitted: 1998-10-26 03:10 UTC Modified: 1998-10-26 06:04 UTC
From: bbonev at netage dot bg Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.5 OS: Linux 2.0.34
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bbonev at netage dot bg
New email:
PHP Version: OS:

 

 [1998-10-26 03:10 UTC] bbonev at netage dot bg
in file.c:
-------
        if (f = getenv("TMPDIR")) {
                (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
                                           *(f + strlen(f) - 1) == '/'? "": "/",
 pfx);
                if (f = mktemp(name))
                        return(f);
        }

        if (f = (char *)dir) {
--------
solution: swap getenv("TMPDIR") and (char*)dir :-))

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-10-26 06:04 UTC] rasmus
The standard tempnam() function is supposed to use the TMPDIR env variable over all else if it is present.  The function is correct as written as far as I can tell.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Mar 28 03:00:01 2026 UTC