From: Sami Kerola Date: Sun, 16 Jun 2013 18:53:42 +0000 (+0100) Subject: renice: exit with non-zero value when arguments cause warnings X-Git-Tag: v2.24-rc1~484 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=665b3c85721e8653bef0c41d0f455e1aebbd2208;p=thirdparty%2Futil-linux.git renice: exit with non-zero value when arguments cause warnings This commit also fixes potential error counter wrap, which theoretically could make command to exit with a success when it internally failed just correct amount of times. Signed-off-by: Sami Kerola --- diff --git a/sys-utils/renice.c b/sys-utils/renice.c index 50b16422bd..c0378e1a56 100644 --- a/sys-utils/renice.c +++ b/sys-utils/renice.c @@ -138,6 +138,7 @@ main(int argc, char **argv) if (pwd == NULL) { warnx(_("unknown user %s"), *argv); + errs = 1; continue; } who = pwd->pw_uid; @@ -145,10 +146,11 @@ main(int argc, char **argv) who = strtol(*argv, &endptr, 10); if (who < 0 || *endptr) { warnx(_("bad value %s"), *argv); + errs = 1; continue; } } - errs += donice(which, who, prio); + errs |= donice(which, who, prio); } return errs != 0 ? EXIT_FAILURE : EXIT_SUCCESS; }