diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2012-05-21 14:10:05 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2012-05-21 15:00:51 +0200 |
commit | 78dda3b093b69f0c13773449dc732be5de40f620 (patch) | |
tree | 07bc8baf01a130b0fa3d497b5c9b39a674de3361 /src/dns-manager | |
parent | 7054f7ad884379b4f7f8090d626134a9c5b59301 (diff) | |
download | NetworkManager-78dda3b093b69f0c13773449dc732be5de40f620.tar.gz |
core: unblock signals for child processes we spawn out of NM (rh #739836)
Commit 217c5bf6ac2284261e5c868d393d4b7d02ca5569 fixed processing of unix
signals: signals are blocked in all threads and a dedicated thread handles the
signals using sigwait().
However, the commit forgot that child processes inherit signal mask as well.
That is why we have to unblock signals for child processes we spawn from NM, so
that they can receive signals.
Diffstat (limited to 'src/dns-manager')
-rw-r--r-- | src/dns-manager/Makefile.am | 2 | ||||
-rw-r--r-- | src/dns-manager/nm-dns-manager.c | 9 | ||||
-rw-r--r-- | src/dns-manager/nm-dns-plugin.c | 9 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/dns-manager/Makefile.am b/src/dns-manager/Makefile.am index 331f85c481..fd31b140cf 100644 --- a/src/dns-manager/Makefile.am +++ b/src/dns-manager/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = \ -I${top_srcdir}/src/logging \ + -I${top_srcdir}/src/posix-signals \ -I${top_srcdir}/libnm-util \ -I${top_builddir}/libnm-util \ -I${top_srcdir}/src \ @@ -28,6 +29,7 @@ libdns_manager_la_CPPFLAGS = \ libdns_manager_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ + $(top_builddir)/src/posix-signals/libnm-posix-signals.la \ $(LIBNL_LIBS) \ $(DBUS_LIBS) \ $(GLIB_LIBS) diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index 6272e3748e..b75aa92b50 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2004 - 2005 Colin Walters <walters@redhat.com> - * Copyright (C) 2004 - 2011 Red Hat, Inc. + * Copyright (C) 2004 - 2012 Red Hat, Inc. * Copyright (C) 2005 - 2008 Novell, Inc. * and others */ @@ -42,6 +42,7 @@ #include "nm-logging.h" #include "backends/nm-backend.h" #include "NetworkManagerUtils.h" +#include "nm-posix-signals.h" #include "nm-dns-plugin.h" #include "nm-dns-dnsmasq.h" @@ -218,6 +219,12 @@ netconfig_child_setup (gpointer user_data G_GNUC_UNUSED) { pid_t pid = getpid (); setpgid (pid, pid); + + /* + * We blocked signals in main(). We need to restore original signal + * mask for netconfig here so that it can receive signals. + */ + nm_unblock_posix_signals (NULL); } static GPid diff --git a/src/dns-manager/nm-dns-plugin.c b/src/dns-manager/nm-dns-plugin.c index e997948e9a..b26f2b9460 100644 --- a/src/dns-manager/nm-dns-plugin.c +++ b/src/dns-manager/nm-dns-plugin.c @@ -13,7 +13,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2010 Red Hat, Inc. + * Copyright (C) 2010 - 2012 Red Hat, Inc. * */ @@ -27,6 +27,7 @@ #include "nm-dns-plugin.h" #include "nm-logging.h" +#include "nm-posix-signals.h" typedef struct { gboolean disposed; @@ -141,6 +142,12 @@ child_setup (gpointer user_data G_GNUC_UNUSED) /* We are in the child process at this point */ pid_t pid = getpid (); setpgid (pid, pid); + + /* + * We blocked signals in main(). We need to restore original signal + * mask for DNS plugin here so that it can receive signals. + */ + nm_unblock_posix_signals (NULL); } GPid |