summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-06-25 10:31:37 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-06-25 10:31:37 +0300
commit406a410bc3b4f245803dec59c1ee4a72aa10e313 (patch)
tree8be580ed1dfec7782787eb580d0b4f2167e2b0b1
parent8b8e27ec5bd47c1dddbc197911e2168bedd71373 (diff)
downloadlibrpm-tizen-406a410bc3b4f245803dec59c1ee4a72aa10e313.tar.gz
librpm-tizen-406a410bc3b4f245803dec59c1ee4a72aa10e313.tar.bz2
librpm-tizen-406a410bc3b4f245803dec59c1ee4a72aa10e313.zip
Don't mmap large files (rhbz#139539, 177616)
Patch from Thomas Woerner
-rw-r--r--rpmdb/legacy.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rpmdb/legacy.c b/rpmdb/legacy.c
index b97d67b70..3968369e2 100644
--- a/rpmdb/legacy.c
+++ b/rpmdb/legacy.c
@@ -167,6 +167,11 @@ int domd5(const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
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: