summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <christian.franke@t-online.de>2024-12-01 13:40:16 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2024-12-09 02:08:52 +0100
commite6f3a3b381fd32fc711b410aff9c9a37b75d353f (patch)
tree3cad56c2162be2eac5cf1b18d5952988d867646a
parent23db6896830d6b37fc3bcc3ad5a7f725eb97d2e1 (diff)
chpst: fix error check of nice(2) call
Check errno instead of return value because -1 is a valid return value also on success. Signed-off-by: Christian Franke <christian.franke@t-online.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--runit/chpst.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/runit/chpst.c b/runit/chpst.c
index 2be1a5775..4e3d613b7 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -466,7 +466,8 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
/* nice should be done before xsetuid */
if (opt & OPT_n) {
errno = 0;
- if (nice(xatoi(nicestr)) == -1)
+ nice(xatoi(nicestr));
+ if (errno)
bb_simple_perror_msg_and_die("nice");
}