From: Karel Zak Date: Mon, 9 Aug 2021 07:45:21 +0000 (+0200) Subject: prlimit: fix compiler warning [-Wmaybe-uninitialized] X-Git-Tag: v2.38-rc1~315 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=87559313dfaf2f949c6ab87d54569d94599b649a;p=thirdparty%2Futil-linux.git 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 --- diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c index 1bdb2cb45a..eba73c751d 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 == '=')