[PATCH] rename resolv.conf.tmp failed.
- From: "Bin Li" <libin charles gmail com>
- To: networkmanager-list gnome org
- Subject: [PATCH] rename resolv.conf.tmp failed.
- Date: Tue, 16 Sep 2008 15:13:21 +0800
Hi,
When network connecting success, dispatch_netconfig() processed
failed for not having the /sbin/netconfig in openSUSE 11.0, then fill
the 'error' info like this:
Failed to execute child process "/sbin/netconfig" (No such file or directory)'
When called the update_resolv_conf(), before rename(), the 'error'
already be set by dispatch_netconfig(), so if (*error == NULL) failed,
so not rename the resolv.conf.tmp to resolv.conf.
In my patch, using local variable used for checking error occurring.
It works fine, but I'm not sure if it's suitable or not, feel free to
change it.
Sincerely Yours,
Bin Li
http://cn.opensuse.org
--- nm-named-manager.c.orig 2008-09-16 10:53:40.000000000 +0800
+++ nm-named-manager.c 2008-09-16 15:11:07.000000000 +0800
@@ -332,6 +332,7 @@
const char *tmp_resolv_conf = RESOLV_CONF ".tmp";
char tmp_resolv_conf_realpath [PATH_MAX];
FILE *f;
+ int err_flag = 0; // local variable used for checking error occurring.
if (!realpath(tmp_resolv_conf, tmp_resolv_conf_realpath))
strcpy(tmp_resolv_conf_realpath, tmp_resolv_conf);
@@ -346,9 +347,12 @@
return FALSE;
}
- write_resolv_conf (f, domain, searches, nameservers, error);
+ if (!write_resolv_conf (f, domain, searches, nameservers, error)) {
+ err_flag = 1;
+ }
if (fclose (f) < 0) {
+ err_flag = 1;
if (*error == NULL) {
g_set_error (error,
NM_NAMED_MANAGER_ERROR,
@@ -359,7 +363,7 @@
}
}
- if (*error == NULL) {
+ if (err_flag == 0) {
if (rename (tmp_resolv_conf, RESOLV_CONF) < 0) {
g_set_error (error,
NM_NAMED_MANAGER_ERROR,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]