Portability: Don't use mkdtemp() when mkdir() will suffice.

If we can't create the dir, just give up.
This commit is contained in:
Tim Kientzle 2007-04-14 05:17:06 +00:00
parent 1df7aefccf
commit 76aa565c72

View File

@ -130,9 +130,9 @@ int main(int argc, char **argv)
*/
now = time(NULL);
strftime(tmpdir, sizeof(tmpdir),
"/tmp/libarchive_test.%Y-%m-%dT%H.%M.%S.XXXXXX",
"/tmp/libarchive_test.%Y-%m-%dT%H.%M.%S",
localtime(&now));
if (mkdtemp(tmpdir) == NULL) {
if (mkdir(tmpdir,0755) != 0) {
fprintf(stderr, "ERROR: Unable to create temp directory %s\n",
tmpdir);
exit(1);