util: introduce sethostname_idempotent
Function queries system hostname and applies changes only when necessary. Also, migrate all client of sethostname to sethostname_idempotent while at it.
This commit is contained in:
@@ -287,7 +287,7 @@ static int context_update_kernel_hostname(Context *c) {
|
||||
else
|
||||
hn = "localhost";
|
||||
|
||||
if (sethostname(hn, strlen(hn)) < 0)
|
||||
if (sethostname_idempotent(hn) < 0)
|
||||
return -errno;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user