From 665b3c85721e8653bef0c41d0f455e1aebbd2208 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 16 Jun 2013 19:53:42 +0100 Subject: 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 --- sys-utils/renice.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys-utils/renice.c') diff --git a/sys-utils/renice.c b/sys-utils/renice.c index 50b16422b..c0378e1a5 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; } -- cgit v1.2.3-55-g7522