summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-04-05 19:33:45 +0000
committerDan Williams <dcbw@redhat.com>2007-04-05 19:33:45 +0000
commit1e167cb23e5588b517dd819b259e51d9022022e6 (patch)
treebcdb535afa008f818155b3d32f4910e3619509f1
parenta7e5954b2400fa962b38ecd06859cb773d47e8c9 (diff)
downloadNetworkManager-1e167cb23e5588b517dd819b259e51d9022022e6.tar.gz
More cleanups and compile fixes
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/branches/nm-0-6-olpc@2539 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
-rw-r--r--src/NetworkManager.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/NetworkManager.c b/src/NetworkManager.c
index 811acfb652..812a346549 100644
--- a/src/NetworkManager.c
+++ b/src/NetworkManager.c
@@ -110,7 +110,7 @@ void fixup_hostname(NMDevice * dev)
char * contents = NULL;
char ** lines = NULL;
gsize length = 0;
- int fd, i = 0, written;
+ int fd, i = 0, written, err;
gboolean success = FALSE;
if (hostname_set)
@@ -140,7 +140,14 @@ void fixup_hostname(NMDevice * dev)
}
nm_info ("Setting hostname: '%s'", hostdomain);
- sethostname (hostdomain, strlen (hostdomain));
+ err = sethostname (hostdomain, strlen (hostdomain));
+ if (err != 0) {
+ nm_warning ("Could not set hostname to '%s': (%d) %s",
+ hostdomain,
+ errno,
+ strerror (errno));
+ goto out;
+ }
hostname_set = TRUE;
if (!g_file_get_contents (ETC_HOSTS_PATH, &contents, &length, NULL))
@@ -229,7 +236,7 @@ out:
nm_spawn_process ("/sbin/restorecon " ETC_HOSTS_PATH);
} else {
nm_warning ("Error updating " ETC_HOSTS_PATH ": (%d) %s",
- strerror (errno));
+ errno, strerror (errno));
success = FALSE;
}
unlink (ETC_HOSTS_PATH_TMP);
@@ -240,7 +247,7 @@ out:
* hostname to 'localhost.localdomain'
*/
const char * def_hostname = "localhost.localdomain";
- sethostname (def_hostname, strlen (def_hostname));
+ err = sethostname (def_hostname, strlen (def_hostname));
}
/* Restart avahi to deal with hostname changes */