Check return value of sethostname(2)
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4082 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -360,7 +360,11 @@ set_system_hostname (const char *new_hostname, const char *msg)
|
||||
if (!update_etc_hosts (name)) {
|
||||
/* error updating /etc/hosts; fallback to localhost.localdomain */
|
||||
nm_info ("Setting system hostname to '" FALLBACK_HOSTNAME "' (error updating /etc/hosts)");
|
||||
sethostname (FALLBACK_HOSTNAME, strlen (FALLBACK_HOSTNAME));
|
||||
ret = sethostname (FALLBACK_HOSTNAME, strlen (FALLBACK_HOSTNAME));
|
||||
if (ret != 0) {
|
||||
nm_warning ("%s: couldn't set the fallback system hostname (%s): (%d) %s",
|
||||
__func__, FALLBACK_HOSTNAME, errno, strerror (errno));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nm_warning ("%s: couldn't set the system hostname to '%s': (%d) %s",
|
||||
|
Reference in New Issue
Block a user