]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Use a writability test for TMPDIR on macOS...
authorMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 27 Feb 2018 22:03:19 +0000 (17:03 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 27 Feb 2018 22:03:19 +0000 (17:03 -0500)
cups/ppd-util.c
cups/tempfile.c

index 07d91d46310b7ccf55694877d58ff6b2dfac7989..5641c79a9afa24def3ffdcfe4b46ee3bca8440fc 100644 (file)
@@ -222,13 +222,12 @@ cupsGetPPD3(http_t     *http,             /* I  - HTTP connection or @code CUPS_HTTP_DEFAUL
        * 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 to get the proper per-user, per-process TMPDIR
-       * value.  Currently this only happens if TMPDIR is not set or is set to
-       * "/Users/...".
+       * value.
        */
 
         char           tmppath[1024];  /* Temporary directory */
 
-       if ((tmpdir = getenv("TMPDIR")) != NULL && !strncmp(tmpdir, "/Users/", 7))
+       if ((tmpdir = getenv("TMPDIR")) != NULL && access(tmpdir, W_OK))
          tmpdir = NULL;
 
        if (!tmpdir)
index 62261469682fe44be70b310c8dd8ce11310e49be..bf26a08e8fae1fc3e66fd3d219219d190d5c84a8 100644 (file)
@@ -63,11 +63,10 @@ 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
   * 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
-  * "/Users/...".
+  * value.
   */
 
-  if ((tmpdir = getenv("TMPDIR")) != NULL && !strncmp(tmpdir, "/Users/", 7))
+  if ((tmpdir = getenv("TMPDIR")) != NULL && access(tmpdir, W_OK))
     tmpdir = NULL;
 
   if (!tmpdir)