diff --git a/magick/utility.c b/magick/utility.c index 5300f97691..9391e31c73 100644 --- a/magick/utility.c +++ b/magick/utility.c @@ -1874,13 +1874,20 @@ MagickPrivate MagickBooleanType ShredFile(const char *path) *property; property=GetPolicyValue("system:shred"); - if (property == (char *) NULL) - property=GetEnvironmentValue("MAGICK_SHRED_PASSES"); if (property != (char *) NULL) { passes=(ssize_t) StringToInteger(property); property=DestroyString(property); } + if (passes == -1) + { + property=GetEnvironmentValue("MAGICK_SHRED_PASSES"); + if (property != (char *) NULL) + { + passes=(ssize_t) StringToInteger(property); + property=DestroyString(property); + } + } } if (passes <= 0) {