]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 18 Apr 2013 19:30:20 +0000 (19:30 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 18 Apr 2013 19:30:20 +0000 (19:30 +0000)
MagickCore/utility.c

index 3114b881a860159eea93ba7238b7463d97547bc0..ed40ae9d70467f2882c504ee1ee0ef0599998072 100644 (file)
@@ -1804,8 +1804,7 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
   if ((path == (const char *) NULL) || (*path == '\0'))
     return(MagickFalse);
   exception=AcquireExceptionInfo();
-  passes=(char *) GetImageRegistry(StringRegistryType,"shred-passes",
-    exception);
+  passes=(char *) GetImageRegistry(StringRegistryType,"shred-passes",exception);
   exception=DestroyExceptionInfo(exception);
   if (passes == (char *) NULL)
     passes=GetEnvironmentValue("MAGICK_SHRED_PASSES");
@@ -1821,7 +1820,13 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
     }
   file=open_utf8(path,O_WRONLY | O_EXCL | O_BINARY,S_MODE);
   if (file == -1)
-    return(MagickFalse);
+    {
+      /*
+        Don't shred the file, just remove it.
+      */
+      status=remove_utf8(path);
+      return(MagickFalse);
+    }
   /*
     Shred the file.
   */
@@ -1870,7 +1875,7 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
   status=remove_utf8(path);
   if (status == -1)
     return(MagickFalse);
-  return(i < StringToInteger(passes) ? MagickFalse : MagickTrue);
+  return(i < (ssize_t) StringToInteger(passes) ? MagickFalse : MagickTrue);
 }
 \f
 /*