Use perrorMsg and clean up exit status.
This commit is contained in:
parent
4758368505
commit
deb9d4d765
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
extern int renice_main(int argc, char **argv)
|
extern int renice_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int prio, err = 0;
|
int prio, status = EXIT_SUCCESS;
|
||||||
|
|
||||||
if (argc < 3) usage(renice_usage);
|
if (argc < 3) usage(renice_usage);
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ extern int renice_main(int argc, char **argv)
|
|||||||
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
|
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
|
||||||
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
|
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "renice: %d: setpriority: ", ps);
|
perrorMsg("%d: setpriority", ps);
|
||||||
perror("");
|
status = EXIT_FAILURE;
|
||||||
err = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit(err);
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
10
renice.c
10
renice.c
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
extern int renice_main(int argc, char **argv)
|
extern int renice_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int prio, err = 0;
|
int prio, status = EXIT_SUCCESS;
|
||||||
|
|
||||||
if (argc < 3) usage(renice_usage);
|
if (argc < 3) usage(renice_usage);
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ extern int renice_main(int argc, char **argv)
|
|||||||
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
|
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
|
||||||
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
|
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "renice: %d: setpriority: ", ps);
|
perrorMsg("%d: setpriority", ps);
|
||||||
perror("");
|
status = EXIT_FAILURE;
|
||||||
err = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit(err);
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user