if (r < 0)
return r;
- hostname_cleanup(s);
+ hostname_cleanup(s, false);
if (isempty(s)) {
free(s);
hn = "localhost";
}
- if (sethostname(hn, strlen(hn)) < 0) {
+ if (sethostname_idempotent(hn) < 0) {
log_warning("Failed to set hostname to <%s>: %m", hn);
return -errno;
}