aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-08 13:49:15 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-08 13:49:15 +0100
commit136fe9bede247d3273f5e82b5e856fa5c15a922c (patch)
tree72c105550fa30d42bfd8344a1550eacb7cc5dcb5
parent9f00a0fdb159432f1d7232253e2180d85e5eca32 (diff)
downloadbusybox-w32-136fe9bede247d3273f5e82b5e856fa5c15a922c.tar.gz
busybox-w32-136fe9bede247d3273f5e82b5e856fa5c15a922c.tar.bz2
busybox-w32-136fe9bede247d3273f5e82b5e856fa5c15a922c.zip
suppress gcc 8 aliasing warnings
function old new delta sigprocmask_SIG_SETMASK - 16 +16 wait_for_child_or_signal 221 213 -8 dowait 432 424 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/libbb.h2
-rw-r--r--libbb/lineedit.c12
-rw-r--r--libbb/signals.c10
-rw-r--r--shell/ash.c2
-rw-r--r--shell/hush.c2
5 files changed, 25 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 9e0970095..638c58412 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -544,6 +544,8 @@ void sig_unblock(int sig) FAST_FUNC;
544int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC; 544int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC;
545/* SIG_BLOCK/SIG_UNBLOCK all signals: */ 545/* SIG_BLOCK/SIG_UNBLOCK all signals: */
546int sigprocmask_allsigs(int how) FAST_FUNC; 546int sigprocmask_allsigs(int how) FAST_FUNC;
547/* SIG_SETMASK set, and return old set in the same set: */
548int sigprocmask_SIG_SETMASK(sigset_t *set) FAST_FUNC;
547/* Standard handler which just records signo */ 549/* Standard handler which just records signo */
548extern smallint bb_got_signal; 550extern smallint bb_got_signal;
549void record_signo(int signo); /* not FAST_FUNC! */ 551void record_signo(int signo); /* not FAST_FUNC! */
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index b6fcd7af0..378f0900a 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2309,6 +2309,16 @@ static int32_t reverse_i_search(int timeout)
2309} 2309}
2310#endif 2310#endif
2311 2311
2312static void sigaction2(int sig, struct sigaction *act)
2313{
2314 // Grr... gcc 8.1.1:
2315 // "passing argument 3 to restrict-qualified parameter aliases with argument 2"
2316 // dance around that...
2317 struct sigaction *oact FIX_ALIASING;
2318 oact = act;
2319 sigaction(sig, act, oact);
2320}
2321
2312/* maxsize must be >= 2. 2322/* maxsize must be >= 2.
2313 * Returns: 2323 * Returns:
2314 * -1 on read errors or EOF, or on bare Ctrl-D, 2324 * -1 on read errors or EOF, or on bare Ctrl-D,
@@ -2419,7 +2429,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2419 /* Install window resize handler (NB: after *all* init is complete) */ 2429 /* Install window resize handler (NB: after *all* init is complete) */
2420 S.SIGWINCH_handler.sa_handler = win_changed; 2430 S.SIGWINCH_handler.sa_handler = win_changed;
2421 S.SIGWINCH_handler.sa_flags = SA_RESTART; 2431 S.SIGWINCH_handler.sa_flags = SA_RESTART;
2422 sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler); 2432 sigaction2(SIGWINCH, &S.SIGWINCH_handler);
2423#endif 2433#endif
2424 read_key_buffer[0] = 0; 2434 read_key_buffer[0] = 0;
2425 while (1) { 2435 while (1) {
diff --git a/libbb/signals.c b/libbb/signals.c
index 3f589321c..5a1544db7 100644
--- a/libbb/signals.c
+++ b/libbb/signals.c
@@ -31,6 +31,16 @@ int FAST_FUNC sigprocmask_allsigs(int how)
31 return sigprocmask(how, &set, NULL); 31 return sigprocmask(how, &set, NULL);
32} 32}
33 33
34int FAST_FUNC sigprocmask_SIG_SETMASK(sigset_t *set)
35{
36 // Grr... gcc 8.1.1:
37 // "passing argument 3 to restrict-qualified parameter aliases with argument 2"
38 // dance around that...
39 sigset_t *oset FIX_ALIASING;
40 oset = set;
41 return sigprocmask(SIG_SETMASK, set, oset);
42}
43
34void FAST_FUNC bb_signals(int sigs, void (*f)(int)) 44void FAST_FUNC bb_signals(int sigs, void (*f)(int))
35{ 45{
36 int sig_no = 0; 46 int sig_no = 0;
diff --git a/shell/ash.c b/shell/ash.c
index 9ce1d1a76..456aca4f0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4217,7 +4217,7 @@ wait_block_or_sig(int *status)
4217 /* Children exist, but none are ready. Sleep until interesting signal */ 4217 /* Children exist, but none are ready. Sleep until interesting signal */
4218#if 1 4218#if 1
4219 sigfillset(&mask); 4219 sigfillset(&mask);
4220 sigprocmask(SIG_SETMASK, &mask, &mask); 4220 sigprocmask_SIG_SETMASK(&mask); /* mask is updated */
4221 while (!got_sigchld && !pending_sig) 4221 while (!got_sigchld && !pending_sig)
4222 sigsuspend(&mask); 4222 sigsuspend(&mask);
4223 sigprocmask(SIG_SETMASK, &mask, NULL); 4223 sigprocmask(SIG_SETMASK, &mask, NULL);
diff --git a/shell/hush.c b/shell/hush.c
index 90191408d..5953ceb9f 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -11442,7 +11442,7 @@ static int wait_for_child_or_signal(struct pipe *waitfor_pipe, pid_t waitfor_pid
11442 * and get stuck in sigsuspend... 11442 * and get stuck in sigsuspend...
11443 */ 11443 */
11444 sigfillset(&oldset); /* block all signals, remember old set */ 11444 sigfillset(&oldset); /* block all signals, remember old set */
11445 sigprocmask(SIG_SETMASK, &oldset, &oldset); 11445 sigprocmask_SIG_SETMASK(&oldset);
11446 11446
11447 if (!sigisemptyset(&G.pending_set)) { 11447 if (!sigisemptyset(&G.pending_set)) {
11448 /* Crap! we raced with some signal! */ 11448 /* Crap! we raced with some signal! */