]> granicus.if.org Git - imagemagick/commitdiff
Check return status of file space allocation
authorCristy <mikayla-grace@urban-warrior.org>
Sun, 27 Jan 2019 13:37:11 +0000 (08:37 -0500)
committerCristy <mikayla-grace@urban-warrior.org>
Sun, 27 Jan 2019 13:37:11 +0000 (08:37 -0500)
MagickCore/cache.c
MagickCore/memory.c

index b1b4f01c35be59c9967c40270f4297e78fd0328b..b0e8d6838c45d36c31f5f1fabb96860325b72db5 100644 (file)
@@ -3625,7 +3625,8 @@ static MagickBooleanType SetPixelCacheExtent(Image *image,MagickSizeType length)
         return(MagickFalse);
 #if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)
       if (cache_info->synchronize != MagickFalse)
-        (void) posix_fallocate(cache_info->file,offset+1,extent-offset);
+        if (posix_fallocate(cache_info->file,offset+1,extent-offset) != 0)
+          return(MagickFalse);
 #endif
     }
   offset=(MagickOffsetType) lseek(cache_info->file,0,SEEK_SET);
index f2c80f75d6acf24df1151491a2b6480049642bda..ae135c0a2afe13663285fdbe9ea0b7b28edb627c 100644 (file)
@@ -650,7 +650,12 @@ MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count,
               if ((offset == (MagickOffsetType) (extent-1)) &&
                   (write(file,"",1) == 1))
                 {
+#if !defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)
                   memory_info->blob=MapBlob(file,IOMode,0,extent);
+#else
+                  if (posix_fallocate(file,0,extent) == 0)
+                    memory_info->blob=MapBlob(file,IOMode,0,extent);
+#endif
                   if (memory_info->blob != NULL)
                     memory_info->type=MapVirtualMemory;
                   else