]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
ippserver used the wrong temporary directory on Windows (STR #4547)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 30 Jan 2015 16:05:50 +0000 (16:05 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 30 Jan 2015 16:05:50 +0000 (16:05 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12454 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-2.0.txt
test/ippserver.c

index a38b05c0f0ecbeb6a70139c8d2a9beda5ce6fdc5..5be858f4e572e162a63d2a60f092cff8ce6e7936 100644 (file)
@@ -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 (<rdar://problem/19121005>)
        - cupsGetPPD* sent bad requests (STR #4567)
+       - ippserver used the wrong temporary directory on Windows (STR #4547)
 
 
 CHANGES IN CUPS V2.0.1
index e6f4094e59f19e13f43c4d62c69783c6b44e0b8b..8e917fd94ddd56b43df812b52318bba551f284ad 100644 (file)
@@ -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));