]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 28 Nov 2012 12:50:22 +0000 (12:50 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 28 Nov 2012 12:50:22 +0000 (12:50 +0000)
MagickCore/resource.c

index 7005ab9428e1180d6c7cddbed08d96f8bbbb53cf..1a679d82ac1273ffe9d2d6facb6266273fa7187f 100644 (file)
@@ -340,7 +340,8 @@ static void *DestroyTemporaryResources(void *temporary_resource)
 static MagickBooleanType GetPathTemplate(char *path)
 {
   char
-    *directory;
+    *directory,
+    *value;
 
   ExceptionInfo
     *exception;
@@ -364,8 +365,6 @@ static MagickBooleanType GetPathTemplate(char *path)
     directory=GetEnvironmentValue("MAGICK_TEMPORARY_PATH");
   if (directory == (char *) NULL)
     directory=GetEnvironmentValue("MAGICK_TMPDIR");
-  if (directory == (char *) NULL)
-    directory=GetPolicyValue("temporary-path");
   if (directory == (char *) NULL)
     directory=GetEnvironmentValue("TMPDIR");
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
@@ -384,16 +383,19 @@ static MagickBooleanType GetPathTemplate(char *path)
 #endif
   if (directory == (char *) NULL)
     return(MagickTrue);
+  value=GetPolicyValue("temporary-path");
+  if (value != (char *) NULL)
+    (void) CloneString(&directory,value);
   if (strlen(directory) > (MaxTextExtent-25))
     {
       directory=DestroyString(directory);
-      return(MagickTrue);
+      return(MagickFalse);
     }
   status=GetPathAttributes(directory,&attributes);
   if ((status == MagickFalse) || !S_ISDIR(attributes.st_mode))
     {
       directory=DestroyString(directory);
-      return(MagickTrue);
+      return(MagickFalse);
     }
   if (directory[strlen(directory)-1] == *DirectorySeparator)
     (void) FormatLocaleString(path,MaxTextExtent,"%smagick-%.20gXXXXXXXXXXXX",