This version makes more clear the printed message specially when the --user option is used. Old version: $ renice 19 10 -u fra -g 1 renice: 10: setpriority: Operation not permitted renice: 1000: setpriority: Operation not permitted renice: 1: setpriority: Operation not permitted $ renice 19 -u fra 1000: old priority 0, new priority 19 New version: $ renice 19 10 -u fra -g 1 renice: failed to set priority for process ID 10: Operation not permitted renice: failed to set priority for user ID 1000: Operation not permitted renice: failed to set priority for process group ID 1: Operation not permitted $ renice 19 -u fra user ID 1000 old priority 0, new priority 19 Signed-off-by: Francesco Cosoleto <cosoleto@xxxxxxxxx> --- sys-utils/renice.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sys-utils/renice.c b/sys-utils/renice.c index d804ca9..ff4c443 100644 --- a/sys-utils/renice.c +++ b/sys-utils/renice.c @@ -151,25 +151,31 @@ main(int argc, char **argv) static int donice(int which, int who, int prio) { int oldprio, newprio; + const char *idtype = _("process ID"); + + if (which == PRIO_USER) + idtype = _("user ID"); + else if (which == PRIO_PGRP) + idtype = _("process group ID"); errno = 0; oldprio = getpriority(which, who); if (oldprio == -1 && errno) { - warn(_("%d: getpriority"), who); + warn(_("failed to get priority for %s %d"), idtype, who); return 1; } if (setpriority(which, who, prio) < 0) { - warn(_("%d: setpriority"), who); + warn(_("failed to set priority for %s %d"), idtype, who); return 1; } errno = 0; newprio = getpriority(which, who); if (newprio == -1 && errno) { - warn(_("%d: getpriority"), who); + warn(_("failed to get priority for %s %d"), idtype, who); return 1; } - printf(_("%d: old priority %d, new priority %d\n"), - who, oldprio, newprio); + printf(_("%s %d old priority %d, new priority %d\n"), + idtype, who, oldprio, newprio); return 0; } -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html