summaryrefslogtreecommitdiff
path: root/usr.bin/renice
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-08-12 00:24:08 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-08-12 00:24:08 +0000
commit0facb5359c1ef6c6a17f7ecd9a1a4cb6c465a605 (patch)
tree1fd3e9f2d1cba9a3636267a42a07de1f34e8901a /usr.bin/renice
parentcd84c72f3ff6c72bc9b2e593a95348848a9b7e26 (diff)
renice(8): don't succeed after 256 errors
Set error instead of incrementing it. Link: https://marc.info/?l=openbsd-tech&m=166025831731506&w=2 ok millert@
Diffstat (limited to 'usr.bin/renice')
-rw-r--r--usr.bin/renice/renice.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/renice/renice.c b/usr.bin/renice/renice.c
index 357f513dc90..ed6e495d821 100644
--- a/usr.bin/renice/renice.c
+++ b/usr.bin/renice/renice.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: renice.c,v 1.21 2019/01/25 00:19:26 millert Exp $ */
+/* $OpenBSD: renice.c,v 1.22 2022/08/12 00:24:07 cheloha Exp $ */
/*
* Copyright (c) 2009, 2015 Todd C. Miller <millert@openbsd.org>
@@ -155,14 +155,14 @@ main(int argc, char **argv)
static int
renice(struct renice_param *p, struct renice_param *end)
{
- int new, old, errors = 0;
+ int new, old, error = 0;
for (; p < end; p++) {
errno = 0;
old = getpriority(p->id_type, p->id);
if (errno) {
warn("getpriority: %d", p->id);
- errors++;
+ error = 1;
continue;
}
if (p->pri_type == RENICE_INCREMENT)
@@ -171,13 +171,13 @@ renice(struct renice_param *p, struct renice_param *end)
p->pri < PRIO_MIN ? PRIO_MIN : p->pri;
if (setpriority(p->id_type, p->id, new) == -1) {
warn("setpriority: %d", p->id);
- errors++;
+ error = 1;
continue;
}
printf("%d: old priority %d, new priority %d\n",
p->id, old, new);
}
- return (errors);
+ return error;
}
__dead void