mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 19:00:11 +01:00
core: ignore SIGPIPE
Ignoring SIGPIPE signal, otherwise it causes problems. For example, running `NetworkManager --debug 2>&1 | tee log.txt` in a terminal and killing it with CTRL+C (SIGINT), will abruplty terminate NetworkManager without clean shutdown. Note, that with this patch and above example, NetworkManager will both receive SIGINT and SIGPIPE. Since we now ignore SIGPIPE, NetworkManager will shut down cleanly. Any logging output after killing `tee` is of lost however. Also, there might be other cases where NM reads/writes to a pipe/socket and unexpectedly received SIGPIPE. For example nm-dns-manager.c spawns netconfig (run_netconfig()) and writes the configuration to its stdin. If netconfig dies, the write might fail with EPIPE. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
6153e9e78d
commit
20085b9da8
1 changed files with 4 additions and 0 deletions
|
|
@ -99,6 +99,9 @@ signal_handling_thread (void *arg)
|
|||
/* Reread config stuff like system config files, VPN service files, etc */
|
||||
nm_log_info (LOGD_CORE, "caught signal %d, not supported yet.", signo);
|
||||
break;
|
||||
case SIGPIPE:
|
||||
/* silently ignore signal */
|
||||
break;
|
||||
default:
|
||||
nm_log_err (LOGD_CORE, "caught unexpected signal %d", signo);
|
||||
break;
|
||||
|
|
@ -124,6 +127,7 @@ setup_signals (void)
|
|||
sigaddset (&signal_set, SIGHUP);
|
||||
sigaddset (&signal_set, SIGINT);
|
||||
sigaddset (&signal_set, SIGTERM);
|
||||
sigaddset (&signal_set, SIGPIPE);
|
||||
|
||||
/* Block all signals of interest. */
|
||||
status = pthread_sigmask (SIG_BLOCK, &signal_set, &old_sig_mask);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue