chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
31d5a60
)
networkd: link - only reset transient hostname if it was set by us
author
Tom Gundersen
<teg@jklm.no>
Wed, 19 Feb 2014 14:59:31 +0000
(15:59 +0100)
committer
Tom Gundersen
<teg@jklm.no>
Wed, 19 Feb 2014 15:46:58 +0000
(16:46 +0100)
src/network/networkd-link.c
patch
|
blob
|
history
diff --git
a/src/network/networkd-link.c
b/src/network/networkd-link.c
index 66bcb6bacf051f9ba1afc3381f3c2b3bd25b2fa5..aa23bfbc995900bce786fa951528184d5f93c696 100644
(file)
--- a/
src/network/networkd-link.c
+++ b/
src/network/networkd-link.c
@@
-507,9
+507,14
@@
static int dhcp_lease_lost(Link *link) {
}
if (link->network->dhcp_hostname) {
}
if (link->network->dhcp_hostname) {
- r = set_hostname(link->manager->bus, "");
- if (r < 0)
- log_error("Failed to reset transient hostname");
+ const char *hostname = NULL;
+
+ r = sd_dhcp_lease_get_hostname(link->dhcp_lease, &hostname);
+ if (r >= 0 && hostname) {
+ r = set_hostname(link->manager->bus, "");
+ if (r < 0)
+ log_error("Failed to reset transient hostname");
+ }
}
link->dhcp_lease = sd_dhcp_lease_unref(link->dhcp_lease);
}
link->dhcp_lease = sd_dhcp_lease_unref(link->dhcp_lease);