mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: missing checks of syscalls
Check for sigaction,sigprocmask,pthread_sigmask errors
This commit is contained in:
parent
50fb24f5c2
commit
67bdae0697
@ -887,7 +887,8 @@ static void main_loop(int cmd_timeout)
|
||||
sigemptyset(&ss);
|
||||
sigaddset(&ss, SIGINT);
|
||||
sigaddset(&ss, SIGTERM);
|
||||
pthread_sigmask(SIG_UNBLOCK, &ss, NULL);
|
||||
if (pthread_sigmask(SIG_UNBLOCK, &ss, NULL))
|
||||
log_warn("WARNING: Failed to unblock SIGCHLD.");
|
||||
/* Main loop */
|
||||
while (!quit) {
|
||||
fd_set in;
|
||||
@ -1731,11 +1732,12 @@ static __attribute__ ((noreturn)) void *pre_and_post_thread(void *arg)
|
||||
SIGUSR2 (kills subthreads) */
|
||||
sigemptyset(&ss);
|
||||
sigaddset(&ss, SIGUSR1);
|
||||
pthread_sigmask(SIG_BLOCK, &ss, NULL);
|
||||
|
||||
if (pthread_sigmask(SIG_BLOCK, &ss, NULL))
|
||||
log_warn("WARNING: Failed to block SIGUSR1.");
|
||||
sigdelset(&ss, SIGUSR1);
|
||||
sigaddset(&ss, SIGUSR2);
|
||||
pthread_sigmask(SIG_UNBLOCK, &ss, NULL);
|
||||
if (pthread_sigmask(SIG_UNBLOCK, &ss, NULL))
|
||||
log_warn("WARNING: Failed to unblock SIGUSR2.");
|
||||
|
||||
/* Loop around doing PRE and POST functions until the client goes away */
|
||||
while (!client->bits.localsock.finished) {
|
||||
|
@ -663,14 +663,17 @@ void daemon_start(daemon_state s)
|
||||
FD_SET(s.socket_fd, &in);
|
||||
|
||||
_reap(s, 0);
|
||||
sigprocmask(SIG_SETMASK, &new_set, NULL);
|
||||
if (sigprocmask(SIG_SETMASK, &new_set, NULL))
|
||||
perror("sigprocmask error");
|
||||
if (_shutdown_requested && !s.threads->next) {
|
||||
sigprocmask(SIG_SETMASK, &old_set, NULL);
|
||||
if (sigprocmask(SIG_SETMASK, &old_set, NULL))
|
||||
perror("sigprocmask error");
|
||||
INFO(&s, "%s shutdown requested", s.name);
|
||||
break;
|
||||
}
|
||||
ret = pselect(s.socket_fd + 1, &in, NULL, NULL, _get_timeout(s), &old_set);
|
||||
sigprocmask(SIG_SETMASK, &old_set, NULL);
|
||||
if (sigprocmask(SIG_SETMASK, &old_set, NULL))
|
||||
perror("sigprocmask error");
|
||||
|
||||
if (ret < 0) {
|
||||
if (errno != EINTR && errno != EAGAIN &&
|
||||
|
@ -59,7 +59,8 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)
|
||||
|
||||
log_verbose("Forking background process from command: %s", cmd->cmd_line);
|
||||
|
||||
sigaction(SIGCHLD, &act, NULL);
|
||||
if (sigaction(SIGCHLD, &act, NULL))
|
||||
log_warn("WARNING: Failed to set SIGCHLD action.");
|
||||
|
||||
if (!skip_lvm)
|
||||
if (!sync_local_dev_names(cmd)) { /* Flush ops and reset dm cookie */
|
||||
|
Loading…
Reference in New Issue
Block a user