]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Only set CFProcessPath if envp is not NULL.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 6 Apr 2006 20:32:07 +0000 (20:32 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 6 Apr 2006 20:32:07 +0000 (20:32 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@5376 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/process.c

index 9ab4eaffd40465fe30b2e31fd4e4ac04bb1a6b0a..03cdbd9290618c02dd4d28789bf8861cfa4c2b3a 100644 (file)
@@ -140,31 +140,34 @@ cupsdStartProcess(
                   command, argv, envp, infd, outfd, errfd);
 
 #if defined(__APPLE__)
- /*
-  * Add special voodoo magic for MacOS X - this allows MacOS X 
-  * programs to access their bundle resources properly...
-  */
-
-  if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
+  if (envp)
   {
    /*
-    * Yes, this is a symlink to the actual program, nul-terminate and
-    * use it...
+    * Add special voodoo magic for MacOS X - this allows MacOS X 
+    * programs to access their bundle resources properly...
     */
 
-    linkpath[linkbytes] = '\0';
+    if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
+    {
+     /*
+      * Yes, this is a symlink to the actual program, nul-terminate and
+      * use it...
+      */
+
+      linkpath[linkbytes] = '\0';
 
-    if (linkpath[0] == '/')
-      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
-              linkpath);
+      if (linkpath[0] == '/')
+       snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
+                linkpath);
+      else
+       snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
+                dirname(command), linkpath);
+    }
     else
-      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
-              dirname(command), linkpath);
-  }
-  else
-    snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
+      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
 
-  envp[0] = processPath;               /* Replace <CFProcessPath> string */
+    envp[0] = processPath;             /* Replace <CFProcessPath> string */
+  }
 #endif /* __APPLE__ */
 
  /*