summaryrefslogtreecommitdiff
path: root/src/hostname
diff options
context:
space:
mode:
Diffstat (limited to 'src/hostname')
-rw-r--r--src/hostname/hostnamectl.c1
-rw-r--r--src/hostname/hostnamed.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index ff1f091776..7945c86b5f 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -36,6 +36,7 @@
#include "strv.h"
#include "sd-id128.h"
#include "virt.h"
+#include "fileio.h"
static enum transport {
TRANSPORT_NORMAL,
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index c5a8b6faaf..7ea891c681 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -33,6 +33,8 @@
#include "def.h"
#include "virt.h"
#include "env-util.h"
+#include "fileio-label.h"
+#include "label.h"
#define INTERFACE \
" <interface name=\"org.freedesktop.hostname1\">\n" \
@@ -287,8 +289,7 @@ static int write_data_static_hostname(void) {
return 0;
}
-
- return write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+ return write_one_line_file_atomic_label("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
}
static int write_data_other(void) {
@@ -338,7 +339,7 @@ static int write_data_other(void) {
return 0;
}
- r = write_env_file("/etc/machine-info", l);
+ r = write_env_file_label("/etc/machine-info", l);
strv_free(l);
return r;
@@ -683,6 +684,7 @@ int main(int argc, char *argv[]) {
log_open();
umask(0022);
+ label_init("/etc");
if (argc == 2 && streq(argv[1], "--introspect")) {
fputs(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE