From b0a365f74a0ac43fcbd53738844e577b2d9ec391 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 1 Dec 2008 21:16:46 +0000 Subject: hostid: improve extremely unreadable parts *: remove checks of sigaction and sigprocmask results in cases where they clearly can't fail: sigaction(known_good_sig) sigprocmask(known_good_how) text data bss dec hex filename - 393 4 0 397 18d libc/pwd_grp/lckpwdf.o + 382 4 0 386 182 libc/pwd_grp/lckpwdf.o - 56 0 0 56 38 libc/signal/sigblock.o + 44 0 0 44 2c libc/signal/sigblock.o - 211 0 0 211 d3 libc/signal/sigset.o + 202 0 0 202 ca libc/signal/sigset.o - 56 0 0 56 38 libc/signal/sigsetmask.o + 44 0 0 44 2c libc/signal/sigsetmask.o - 309 0 0 309 135 libc/unistd/sleep.o + 256 0 0 256 100 libc/unistd/sleep.o --- libc/signal/sigset.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libc/signal/sigset.c') diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c index 91f433661..03f3dc869 100644 --- a/libc/signal/sigset.c +++ b/libc/signal/sigset.c @@ -42,13 +42,11 @@ __sighandler_t sigset (int sig, __sighandler_t disp) /* Handle SIG_HOLD first. */ if (disp == SIG_HOLD) { - /* Create an empty signal set. */ __sigemptyset (&set); __sigaddset (&set, sig); /* Add the signal set to the current signal mask. */ - if (sigprocmask (SIG_BLOCK, &set, NULL) < 0) - return SIG_ERR; + sigprocmask (SIG_BLOCK, &set, NULL); /* can't fail */ return SIG_HOLD; } @@ -56,6 +54,7 @@ __sighandler_t sigset (int sig, __sighandler_t disp) memset(&act, 0, sizeof(act)); act.sa_handler = disp; + /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */ if (sigaction (sig, &act, &oact) < 0) return SIG_ERR; @@ -64,8 +63,7 @@ __sighandler_t sigset (int sig, __sighandler_t disp) __sigaddset (&set, sig); /* Remove the signal set from the current signal mask. */ - if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) - return SIG_ERR; + sigprocmask (SIG_UNBLOCK, &set, NULL); /* can't fail */ return oact.sa_handler; } -- cgit v1.2.3