From 222d4ff7fcfe38486f0741ff5ab0aa5cdb5f9869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 12 Aug 2015 03:12:06 +0200 Subject: [PATCH] add support for setting xz memlimit Merged-by: Vitaly Chikunov --- rpmio/rpmio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index 9b6c5c0..bf47455 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -2777,6 +2777,7 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x FILE *fp; LZFILE *lzfile; lzma_ret ret; + uint64_t mem_limit = rpmExpandNumeric("%{_xz_memlimit}"); for (; *mode; mode++) { if (*mode == 'w') @@ -2828,7 +2829,7 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x /* We set the memlimit for decompression to 100MiB which should be * more than enough to be sufficient for level 9 which requires 65 MiB. */ - ret = lzma_auto_decoder(&lzfile->strm, 100<<20, 0); + ret = lzma_auto_decoder(&lzfile->strm, mem_limit ? mem_limit : 100<<20, 0); } if (ret != LZMA_OK) { switch (ret) {