[Rpm-maint] [Patch 13/19] Don't mmap large files

Paul Nasrat pnasrat at redhat.com
Fri Feb 9 11:46:31 UTC 2007


This patch prevents mapping into memory large files when calculating
digests.

--- rpm-4.4.2/rpmdb/legacy.c.no_large_mmap	2006-01-10 11:25:28.000000000 +0000
+++ rpm-4.4.2/rpmdb/legacy.c	2006-01-10 11:25:31.000000000 +0000
@@ -167,6 +167,11 @@
 	goto exit;
     }
 
+    /* file to large (32 MB), do not mmap file */
+    if (fsize > (size_t) 32*1024*1024)
+      if (ut == URL_IS_PATH || ut == URL_IS_UNKNOWN)
+	ut = URL_IS_DASH; /* force fd io */
+
     switch(ut) {
     case URL_IS_PATH:
     case URL_IS_UNKNOWN:





More information about the Rpm-maint mailing list