From 5f0c23f1067a7f49d56a27592eb315aebb0b94cf Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 3 May 2015 14:24:57 +0200 Subject: [PATCH] dns-manager: fail dns config if netconfig exits with non-zero status If netconfig does not exit with zero status signal, assume configuration failed and signal an error. --- src/dns-manager/nm-dns-manager.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index be7180e40..160e6fb35 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -327,6 +327,13 @@ dispatch_netconfig (char **searches, strerror (errsv)); return FALSE; } + if (!WIFEXITED (status) || WEXITSTATUS (status) != EXIT_SUCCESS) { + g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, + "Error calling netconfig: %s %d", + WIFEXITED (status) ? "exited with status" : (WIFSIGNALED (status) ? "exited with signal" : "exited with unknown reason"), + WIFEXITED (status) ? WEXITSTATUS (status) : (WIFSIGNALED (status) ? WTERMSIG (status) : status)); + return FALSE; + } return TRUE; }