mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 04:24:32 +00:00
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:
parent
3a0b1d645b
commit
ba2ad655de
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue