util-linux/backport-prlimit-fix-optional-arguments-parsing.patch
2022-03-16 14:11:16 +08:00

32 lines
863 B
Diff

From 1ad8db5521ec03d41a058674437f648d15ef8344 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 18 Mar 2021 10:23:36 +0100
Subject: [PATCH] prlimit: fix optional arguments parsing
$ prlimit -f=100:100
failed to parse FSIZE limit
Fixes: https://github.com/karelzak/util-linux/issues/1265
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/prlimit.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c
index 6078490..17db3d8 100644
--- a/sys-utils/prlimit.c
+++ b/sys-utils/prlimit.c
@@ -451,6 +451,9 @@ static int parse_prlim(struct rlimit *lim, char *ops, size_t id)
rlim_t soft, hard;
int found = 0;
+ if (ops && *ops == '=')
+ ops++;
+
if (get_range(ops, &soft, &hard, &found))
errx(EXIT_FAILURE, _("failed to parse %s limit"),
prlimit_desc[id].name);
--
1.8.3.1