From 30ffd04a9415713006c45fdc3e7978b8bfae0352 Mon Sep 17 00:00:00 2001 From: "Z. Liu" Date: Sun, 25 Aug 2024 00:47:38 +0800 Subject: fix compilation warning(s): -Wunsequenced found by using clang 18 with CFLAGS: -Wall link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches 0016-fix-warning-for-undefined-operation-on-sequence-poin.patch chpst.c:312:33: warning: unsequenced modification and access to 'subgetoptarg' [-Wunsequenced] 312 | if (optarg[scan_ulong(++optarg, &ul)]) usage(); nicelvl =ul; | ~~~~~~ ^ gcc report: chpst.c:312:33: warning: operation on 'subgetoptarg' may be undefined [-Wsequence-point] --- src/chpst.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chpst.c b/src/chpst.c index 86032bc..d65e8fd 100644 --- a/src/chpst.c +++ b/src/chpst.c @@ -308,7 +308,8 @@ int main(int argc, char **argv) { case 'n': switch (*optarg) { case '-': - if (optarg[scan_ulong(++optarg, &ul)]) usage(); nicelvl =ul; + ++optarg; + if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul; nicelvl *=-1; break; case '+': ++optarg; -- cgit 1.4.1