Skip to content

Commit

Permalink
solaris missing mkdtemp
Browse files Browse the repository at this point in the history
  • Loading branch information
dstndstn committed Dec 12, 2015
1 parent ede1343 commit f038a34
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions util/ioutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,20 @@ char* create_temp_dir(const char* name, const char* dir) {
dir = get_temp_dir();
}
asprintf_safe(&tempdir, "%s/tmp.%s.XXXXXX", dir, name);
// no mkdtemp() in some versions of Solaris;
// https://groups.google.com/forum/#!topic/astrometry/quGEbY1CgR8
#if defined(__sun)
mktemp(tempdir);
if (!mkdir(tempdir, 0700)) {
SYSERROR("Failed to create temp dir");
return NULL;
}
#else
if (!mkdtemp(tempdir)) {
SYSERROR("Failed to create temp dir");
return NULL;
}
#endif
return tempdir;
}

Expand Down

0 comments on commit f038a34

Please sign in to comment.