]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
signal-util: make sigaction_many_ap a little more concise
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Fri, 30 Oct 2020 09:27:55 +0000 (10:27 +0100)
committerRasmus Villemoes <rasmus.villemoes@prevas.dk>
Tue, 3 Nov 2020 13:26:08 +0000 (14:26 +0100)
There's no reason to duplicate the stop condition sig < 0, nor the sigaction()
call.

src/basic/signal-util.c

index cb59f6ca0f2639648989e22f2361f545c414f970..e976205d86858513e0ab873acd1dc72989f41c6f 100644 (file)
@@ -49,16 +49,7 @@ static int sigaction_many_ap(const struct sigaction *sa, int sig, va_list ap) {
         int r = 0;
 
         /* negative signal ends the list. 0 signal is skipped. */
-
-        if (sig < 0)
-                return 0;
-
-        if (sig > 0) {
-                if (sigaction(sig, sa, NULL) < 0)
-                        r = -errno;
-        }
-
-        while ((sig = va_arg(ap, int)) >= 0) {
+        for (; sig >= 0; sig = va_arg(ap, int)) {
 
                 if (sig == 0)
                         continue;