summaryrefslogtreecommitdiff
path: root/test/ippserver.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/ippserver.c')
-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));