X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=cups%2Ftempfile.c;fp=cups%2Ftempfile.c;h=dcd81736de3e28a1b4b9dca785e629d08972a1bf;hb=9b440f8a5cfa0214833196db7ea0639036eaec34;hp=97972bd829bcc65cc7c4279f491b3f85beceb23d;hpb=3cd7b5e053f8100da1ca8d8daf93976cca3516ef;p=thirdparty%2Fcups.git diff --git a/cups/tempfile.c b/cups/tempfile.c index 97972bd82..dcd81736d 100644 --- a/cups/tempfile.c +++ b/cups/tempfile.c @@ -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 - * 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;