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 <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-08-09 09:45:21 +02:00
parent ebd4749115
commit f6dd7b20cd
1 changed files with 1 additions and 1 deletions

View File

@ -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 == '=')