summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/arping.c14
-rw-r--r--networking/httpd.c15
-rw-r--r--networking/inetd.c12
-rw-r--r--networking/wget.c9
4 files changed, 12 insertions, 38 deletions
diff --git a/networking/arping.c b/networking/arping.c
index c89b975..2277ec5 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -377,18 +377,8 @@ int arping_main(int argc, char **argv)
printf(" from %s via %s\n", inet_ntoa(src), device);
}
- {
- struct sigaction sa;
-
- memset(&sa, 0, sizeof(sa));
- sa.sa_flags = SA_RESTART;
-
- sa.sa_handler = (void (*)(int)) finish;
- sigaction(SIGINT, &sa, NULL);
-
- sa.sa_handler = (void (*)(int)) catcher;
- sigaction(SIGALRM, &sa, NULL);
- }
+ signal_SA_RESTART_empty_mask(SIGINT, (void (*)(int))finish);
+ signal_SA_RESTART_empty_mask(SIGALRM, (void (*)(int))catcher);
catcher();
diff --git a/networking/httpd.c b/networking/httpd.c
index e913728..7b7446e 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1788,7 +1788,6 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
char *header_ptr = header_ptr;
Htaccess_Proxy *proxy_entry;
#endif
- struct sigaction sa;
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
int credentials = -1; /* if not required this is Ok */
#endif
@@ -1819,11 +1818,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
}
/* Install timeout handler */
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = exit_on_signal;
- /* sigemptyset(&sa.sa_mask); - memset should be enough */
- /*sa.sa_flags = 0; - no SA_RESTART */
- sigaction(SIGALRM, &sa, NULL);
+ signal_no_SA_RESTART_empty_mask(SIGALRM, exit_on_signal);
alarm(HEADER_READ_TIMEOUT);
if (!get_line()) /* EOF or error or empty line */
@@ -2247,15 +2242,9 @@ static void mini_httpd_inetd(void)
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
static void sighup_handler(int sig)
{
- struct sigaction sa;
-
parse_conf(default_path_httpd_conf, sig == SIGHUP ? SIGNALED_PARSE : FIRST_PARSE);
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = sighup_handler;
- /*sigemptyset(&sa.sa_mask); - memset should be enough */
- sa.sa_flags = SA_RESTART;
- sigaction(SIGHUP, &sa, NULL);
+ signal_SA_RESTART_empty_mask(SIGHUP, sighup_handler);
}
#endif
diff --git a/networking/inetd.c b/networking/inetd.c
index 463c7cf..196f6d2 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1179,15 +1179,15 @@ int inetd_main(int argc, char **argv)
sigaddset(&sa.sa_mask, SIGCHLD);
sigaddset(&sa.sa_mask, SIGHUP);
sa.sa_handler = retry_network_setup;
- sigaction(SIGALRM, &sa, NULL);
+ sigaction_set(SIGALRM, &sa);
sa.sa_handler = reread_config_file;
- sigaction(SIGHUP, &sa, NULL);
+ sigaction_set(SIGHUP, &sa);
sa.sa_handler = reap_child;
- sigaction(SIGCHLD, &sa, NULL);
+ sigaction_set(SIGCHLD, &sa);
sa.sa_handler = clean_up_and_exit;
- sigaction(SIGTERM, &sa, NULL);
+ sigaction_set(SIGTERM, &sa);
sa.sa_handler = clean_up_and_exit;
- sigaction(SIGINT, &sa, NULL);
+ sigaction_set(SIGINT, &sa);
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sa, &saved_pipe_handler);
@@ -1382,7 +1382,7 @@ int inetd_main(int argc, char **argv)
* for nowait stream children */
for (sep2 = serv_list; sep2; sep2 = sep2->se_next)
maybe_close(sep2->se_fd);
- sigaction(SIGPIPE, &saved_pipe_handler, NULL);
+ sigaction_set(SIGPIPE, &saved_pipe_handler);
unblock_sigs(&omask);
BB_EXECVP(sep->se_program, sep->se_argv);
bb_perror_msg("exec %s", sep->se_program);
diff --git a/networking/wget.c b/networking/wget.c
index 36a8356..a77a2ad 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -144,13 +144,8 @@ static void progressmeter(int flag)
transferred = 0;
fputc('\n', stderr);
} else {
- if (flag == -1) {
- /* first call to progressmeter */
- struct sigaction sa;
- sa.sa_handler = progressmeter;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = SA_RESTART;
- sigaction(SIGALRM, &sa, NULL);
+ if (flag == -1) { /* first call to progressmeter */
+ signal_SA_RESTART_empty_mask(SIGALRM, progressmeter);
}
alarm(1);
}