Ignore:
Timestamp:
Jun 17, 2007, 2:11:18 AM (18 years ago)
Author:
bird
Message:

do _realrealpath on the TMPDIR before using it. Fixes #179.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/emx/src/emxomf/weakld.c

    r2692 r3462  
    36113611    unsigned        c = 0;
    36123612    pid_t           pid = getpid();
    3613     const char *    pszTmp = getenv("TMP");
    3614     if (!pszTmp)    pszTmp = getenv("TMPDIR");
    3615     if (!pszTmp)    pszTmp = getenv("TEMP");
    3616     if (!pszTmp)    pszTmp = ".";
     3613    static char     s_szTmp[_MAX_PATH + 1];
     3614   
     3615    /* We need to apply _realrealpath to the tmpdir, so resolve that once and for all. */
     3616    if (!s_szTmp[0])
     3617    {
     3618        const char *    pszTmp = getenv("TMP");
     3619        if (!pszTmp)    pszTmp = getenv("TMPDIR");
     3620        if (!pszTmp)    pszTmp = getenv("TEMP");
     3621        if (!pszTmp)    pszTmp = ".";
     3622        if (!_realrealpath(pszTmp, s_szTmp, sizeof(s_szTmp)))
     3623        {
     3624            printf("emxomfld: _realrealpath failed on '%s'!!!\n", pszTmp);
     3625            exit(1);
     3626        }
     3627    }
    36173628
    36183629    do
     
    36223633            return -1;
    36233634        gettimeofday(&tv, NULL);
    3624         sprintf(pszFile, "%s\\%s%x%lx%d%lx%s", pszTmp, pszPrefix, pid, tv.tv_sec, c, tv.tv_usec, pszSuffix);
     3635        sprintf(pszFile, "%s\\%s%x%lx%d%lx%s", s_szTmp, pszPrefix, pid, tv.tv_sec, c, tv.tv_usec, pszSuffix);
    36253636    } while (!stat(pszFile, &s));
    36263637
Note: See TracChangeset for help on using the changeset viewer.