diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c
index 0d93d8b..612474c 100644
--- a/src/dns-manager/nm-dns-manager.c
+++ b/src/dns-manager/nm-dns-manager.c
@@ -447,6 +447,7 @@ update_resolv_conf (char **searches,
 	FILE *f;
 	int do_rename = 1;
 	int old_errno = 0;
+	GError *local = NULL;
 
 	g_return_val_if_fail (error != NULL, FALSE);
 
@@ -485,10 +486,10 @@ update_resolv_conf (char **searches,
 		strcpy (tmp_resolv_conf_realpath, _PATH_RESCONF);
 	}
 
-	write_resolv_conf (f, searches, nameservers, error);
+	write_resolv_conf (f, searches, nameservers, &local);
 
 	if (fclose (f) < 0) {
-		if (*error == NULL) {
+		if (local == NULL) {
 			/* only set an error here if write_resolv_conf() was successful,
 			 * since its error is more important.
 			 */
@@ -504,7 +505,7 @@ update_resolv_conf (char **searches,
 	/* Don't rename the tempfile over top of the existing resolv.conf if there
 	 * was an error writing it out.
 	 */
-	if (*error == NULL && do_rename) {
+	if (local == NULL && do_rename) {
 		if (rename (tmp_resolv_conf_realpath, resolv_conf_realpath) < 0) {
 			g_set_error (error,
 			             NM_MANAGER_ERROR,
@@ -514,6 +515,8 @@ update_resolv_conf (char **searches,
 		}
 	}
 
+	g_propagate_error (error, local);
+
 out:
 	free (tmp_resolv_conf_realpath);
 	free (resolv_conf_realpath);
