From 045938074d16e9dd4970bbe87ec2339f360cd320 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 19 May 2015 09:33:05 +0200 Subject: [PATCH] dns: accept NULL error argument in update_resolv_conf() --- src/dns-manager/nm-dns-manager.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index caa1c2c69a..4d892fe392 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -503,8 +503,7 @@ update_resolv_conf (char **searches, { FILE *f; struct stat st; - - g_return_val_if_fail (error != NULL, FALSE); + gboolean ret; /* If we are not managing /etc/resolv.conf and it points to * MY_RESOLV_CONF, don't write the private DNS configuration to @@ -534,10 +533,10 @@ update_resolv_conf (char **searches, return FALSE; } - write_resolv_conf (f, searches, nameservers, options, error); + ret = write_resolv_conf (f, searches, nameservers, options, error); if (fclose (f) < 0) { - if (*error == NULL) { + if (ret) { /* only set an error here if write_resolv_conf() was successful, * since its error is more important. */ @@ -550,7 +549,7 @@ update_resolv_conf (char **searches, } } - if (*error) + if (!ret) return FALSE; if (rename (MY_RESOLV_CONF_TMP, MY_RESOLV_CONF) < 0) {