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 <kerolasa@iki.fi>
if (pwd == NULL) {
warnx(_("unknown user %s"), *argv);
+ errs = 1;
continue;
}
who = pwd->pw_uid;
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;
}