From f6dd7b20cdcb5b6a8aae4877024026f1eefaea73 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 9 Aug 2021 09:45:21 +0200 Subject: [PATCH] prlimit: fix compiler warning [-Wmaybe-uninitialized] sys-utils/prlimit.c:467:16: warning: 'hard' may be used uninitialized in this function [-Wmaybe-uninitialized] lim->rlim_max = hard; ~~~~~~~~~~~~~~^~~~~~ sys-utils/prlimit.c:456:15: note: 'hard' was declared here rlim_t soft, hard; ^~~~ sys-utils/prlimit.c:466:16: warning: 'soft' may be used uninitialized in this function [-Wmaybe-uninitialized] lim->rlim_cur = soft; ~~~~~~~~~~~~~~^~~~~~ sys-utils/prlimit.c:456:9: note: 'soft' was declared here rlim_t soft, hard; ^~~~ References: https://github.com/karelzak/util-linux/issues/1406 Signed-off-by: Karel Zak --- sys-utils/prlimit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c index 1bdb2cb45..eba73c751 100644 --- a/sys-utils/prlimit.c +++ b/sys-utils/prlimit.c @@ -453,7 +453,7 @@ static int get_range(char *str, rlim_t *soft, rlim_t *hard, int *found) static int parse_prlim(struct rlimit *lim, char *ops, size_t id) { - rlim_t soft, hard; + rlim_t soft = 0, hard = 0; int found = 0; if (ops && *ops == '=')