summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2015-01-30 16:05:50 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2015-01-30 16:05:50 +0000
commit12f009bb470b6b13c82005e93895558456d1aab6 (patch)
tree24da7270bfad9458d05e88fe6b006247ff04bb10 /test
parent62bd8d91877f4f6f528195192e3d351c60d42e14 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/ippserver.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/ippserver.c b/test/ippserver.c
index e6f4094e5..8e917fd94 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));