From: msweet Date: Fri, 30 Jan 2015 16:05:50 +0000 (+0000) Subject: ippserver used the wrong temporary directory on Windows (STR #4547) X-Git-Tag: v2.2b1~368 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12f009bb470b6b13c82005e93895558456d1aab6;p=thirdparty%2Fcups.git ippserver used the wrong temporary directory on Windows (STR #4547) git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12454 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-2.0.txt b/CHANGES-2.0.txt index a38b05c0f0..5be858f4e5 100644 --- a/CHANGES-2.0.txt +++ b/CHANGES-2.0.txt @@ -27,6 +27,7 @@ CHANGES IN CUPS V2.0.2 - Mapping of PPD keywords to IPP keywords did not work if the PPD keyword was already an IPP keyword () - cupsGetPPD* sent bad requests (STR #4567) + - ippserver used the wrong temporary directory on Windows (STR #4547) CHANGES IN CUPS V2.0.1 diff --git a/test/ippserver.c b/test/ippserver.c index e6f4094e59..8e917fd94d 100644 --- a/test/ippserver.c +++ b/test/ippserver.c @@ -3,7 +3,7 @@ * * Sample IPP Everywhere server for CUPS. * - * Copyright 2010-2014 by Apple Inc. + * Copyright 2010-2015 by Apple Inc. * * These coded instructions, statements, and computer programs are the * property of Apple Inc. and are protected by Federal copyright @@ -630,9 +630,22 @@ main(int argc, /* I - Number of command-line args */ if (!directory[0]) { - snprintf(directory, sizeof(directory), "/tmp/ippserver.%d", (int)getpid()); + const char *tmpdir; /* Temporary directory */ - if (mkdir(directory, 0777) && errno != EEXIST) +#ifdef WIN32 + if ((tmpdir = getenv("TEMP")) == NULL) + tmpdir = "C:/TEMP"; +#elif defined(__APPLE__) + if ((tmpdir = getenv("TMPDIR")) == NULL) + tmpdir = "/private/tmp"; +#else + if ((tmpdir = getenv("TMPDIR")) == NULL) + tmpdir = "/tmp"; +#endif /* WIN32 */ + + snprintf(directory, sizeof(directory), "%s/ippserver.%d", tmpdir, (int)getpid()); + + if (mkdir(directory, 0755) && errno != EEXIST) { fprintf(stderr, "Unable to create spool directory \"%s\": %s\n", directory, strerror(errno));