Changeset 21929 for trunk/tools


Ignore:
Timestamp:
Dec 29, 2011, 5:11:20 PM (14 years ago)
Author:
dmik
Message:

Replace tmpnam() with tempnam().

The former in EMX returns paths relative to the current
directory while it should be relative to %TMP%.

r21928 also does that.

Location:
trunk/tools/wrc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/wrc/utils.c

    r21551 r21929  
    237237    #endif
    238238    return strcpy(s, str);
     239}
     240
     241char *xtempnam(const char *dir, const char *prefix)
     242{
     243    char *res = tempnam(dir, prefix);
     244    if (!res)
     245    {
     246        fprintf (stderr, "Virtual memory exhausted.\n");
     247        exit (1);
     248    }
     249    return res;
    239250}
    240251
  • trunk/tools/wrc/utils.h

    r8596 r21929  
    2626void *xrealloc(void *, size_t);
    2727char *xstrdup(const char *str);
     28char *xtempnam(const char *dir, const char *prefix);
    2829#endif
    2930
  • trunk/tools/wrc/wrc.c

    r21916 r21929  
    645645        else
    646646        {
    647             if(!(temp_name = tmpnam(NULL)))
    648                 error("Could nor generate a temp-name\n");
    649             temp_name = xstrdup(temp_name);
     647            temp_name = xtempnam(NULL, NULL);
    650648            if(!(ppout = fopen(temp_name, "wb")))
    651649                error("Could not create a temp-file\n");
Note: See TracChangeset for help on using the changeset viewer.