chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core: add log_unit_*_errno() macros
[elogind.git]
/
src
/
core
/
hostname-setup.c
diff --git
a/src/core/hostname-setup.c
b/src/core/hostname-setup.c
index ac508af122a3104c4cad7b049451b2e8e082527d..f81103a8103eb48aa44c1f1c14c97937392d25df 100644
(file)
--- a/
src/core/hostname-setup.c
+++ b/
src/core/hostname-setup.c
@@
-42,7
+42,7
@@
static int read_and_strip_hostname(const char *path, char **hn) {
if (r < 0)
return r;
if (r < 0)
return r;
- hostname_cleanup(s);
+ hostname_cleanup(s
, false
);
if (isempty(s)) {
free(s);
if (isempty(s)) {
free(s);
@@
-64,7
+64,7
@@
int hostname_setup(void) {
if (r == -ENOENT)
enoent = true;
else
if (r == -ENOENT)
enoent = true;
else
- log_warning
("Failed to read configured hostname: %s", strerror(-r)
);
+ log_warning
_errno(r, "Failed to read configured hostname: %m"
);
hn = NULL;
} else
hn = NULL;
} else
@@
-82,7
+82,7
@@
int hostname_setup(void) {
hn = "localhost";
}
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;
}
log_warning("Failed to set hostname to <%s>: %m", hn);
return -errno;
}