]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Tue, 29 Aug 2017 14:11:49 +0000 (10:11 -0400)
committerCristy <urban-warrior@imagemagick.org>
Tue, 29 Aug 2017 14:11:49 +0000 (10:11 -0400)
MagickCore/utility.c

index 64b74ce667b63f2b396a49e1b0fccfc2d585ad91..1306ecc4c1195fd11c888b3db0abdb5f67a6e892 100644 (file)
@@ -157,6 +157,9 @@ MagickExport MagickBooleanType AcquireUniqueSymbolicLink(const char *source,
     destination_file,
     source_file;
 
+  MagickBooleanType
+    status;
+
   size_t
     length,
     quantum;
@@ -227,6 +230,7 @@ MagickExport MagickBooleanType AcquireUniqueSymbolicLink(const char *source,
       (void) RelinquishUniqueFileResource(destination);
       return(MagickFalse);
     }
+  status=MagickTrue;
   for (length=0; ; )
   {
     count=(ssize_t) read(source_file,buffer,quantum);
@@ -236,17 +240,15 @@ MagickExport MagickBooleanType AcquireUniqueSymbolicLink(const char *source,
     count=(ssize_t) write(destination_file,buffer,length);
     if ((size_t) count != length)
       {
-        (void) close(destination_file);
-        (void) close(source_file);
-        buffer=(unsigned char *) RelinquishMagickMemory(buffer);
         (void) RelinquishUniqueFileResource(destination);
-        return(MagickFalse);
+        status=MagickFalse;
+        break;
       }
   }
   (void) close(destination_file);
   (void) close(source_file);
   buffer=(unsigned char *) RelinquishMagickMemory(buffer);
-  return(MagickTrue);
+  return(status);
 }
 \f
 /*
@@ -1889,7 +1891,7 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
       if (i == 0)
         ResetStringInfo(key);  /* zero on first pass */
       count=write(file,GetStringInfoDatum(key),(size_t)
-        MagickMin(quantum,length-j));
+        MagickMin((MagickSizeType) quantum,length-j));
       key=DestroyStringInfo(key);
       if (count <= 0)
         {