]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Simplify tempfile fix for macOS.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 26 Feb 2018 22:14:11 +0000 (17:14 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 26 Feb 2018 22:14:11 +0000 (17:14 -0500)
cups/tempfile.c

index 97972bd829bcc65cc7c4279f491b3f85beceb23d..dcd81736de3e28a1b4b9dca785e629d08972a1bf 100644 (file)
@@ -62,15 +62,15 @@ cupsTempFd(char *filename,          /* I - Pointer to buffer */
  /*
   * On macOS and iOS, the TMPDIR environment variable is not always the best
   * location to place temporary files due to sandboxing.  Instead, the confstr
  /*
   * On macOS and iOS, the TMPDIR environment variable is not always the best
   * location to place temporary files due to sandboxing.  Instead, the confstr
-  * function should be called when running as a normal process (not a child of
-  * cupsd) to get the proper per-user, per-process TMPDIR value.  We know
-  * whether the process is running as a child of cupsd by the presence of the
-  * "SOFTWARE" environment variable that cupsd sets.
+  * function should be called to get the proper per-user, per-process TMPDIR
+  * value.  Currently this only happens if TMPDIR is not set or is set to
+  * "/var/folders/...".
   */
 
   */
 
-  tmpdir = getenv("TMPDIR");
+  if ((tmpdir = getenv("TMPDIR")) != NULL && !strncmp(tmpdir, "/var/folders/", 13))
+    tmpdir = NULL;
 
 
-  if (!getenv("SOFTWARE") || !tmpdir)
+  if (!tmpdir)
   {
     if (confstr(_CS_DARWIN_USER_TEMP_DIR, tmppath, sizeof(tmppath)))
       tmpdir = tmppath;
   {
     if (confstr(_CS_DARWIN_USER_TEMP_DIR, tmppath, sizeof(tmppath)))
       tmpdir = tmppath;