From ba87c495c416b65eca1d683ac980c2c8a673fcac Mon Sep 17 00:00:00 2001 Message-Id: From: Pascal Vizeli Date: Sat, 28 Apr 2018 00:20:08 +0200 Subject: [PATCH 1/2] Allow hostname on ro --- src/hostname/hostnamed.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 7f6607a527..4baccf0b06 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -344,6 +344,7 @@ static int context_update_kernel_hostname( static int context_write_data_static_hostname(Context *c) { assert(c); + FILE *f = NULL; if (isempty(c->data[PROP_STATIC_HOSTNAME])) { @@ -352,7 +353,15 @@ static int context_write_data_static_hostname(Context *c) { return 0; } - return write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]); + + f = fopen("/etc/hostname", "w"); + if (f == NULL) + return -ENOENT; + + fputs(c->data[PROP_STATIC_HOSTNAME], f); + fclose(f); + + return 0; } static int context_write_data_machine_info(Context *c) { -- 2.29.2