2013-02-16 10:43:26 +01:00
|
|
|
Index: systemd-195/src/hostname/hostnamed.c
|
|
|
|
===================================================================
|
|
|
|
--- systemd-195.orig/src/hostname/hostnamed.c
|
|
|
|
+++ systemd-195/src/hostname/hostnamed.c
|
|
|
|
@@ -118,6 +118,10 @@ static int read_data(void) {
|
|
|
|
if (r < 0 && r != -ENOENT)
|
|
|
|
return r;
|
|
|
|
|
|
|
|
+ r = read_one_line_file("/etc/HOSTNAME", &data[PROP_STATIC_HOSTNAME]);
|
|
|
|
+ if (r < 0 && r != -ENOENT)
|
|
|
|
+ return r;
|
|
|
|
+
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-20 11:29:34 +01:00
|
|
|
@@ -204,6 +208,7 @@ static int write_data_hostname(void) {
|
2013-02-16 10:43:26 +01:00
|
|
|
|
|
|
|
static int write_data_static_hostname(void) {
|
|
|
|
|
|
|
|
+ int r;
|
|
|
|
if (isempty(data[PROP_STATIC_HOSTNAME])) {
|
|
|
|
|
|
|
|
if (unlink("/etc/hostname") < 0)
|
2013-03-20 11:29:34 +01:00
|
|
|
@@ -212,7 +217,11 @@ static int write_data_static_hostname(vo
|
2013-02-16 10:43:26 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
- return write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
|
|
|
|
+ r = write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
|
|
|
|
+ if (!r) {
|
|
|
|
+ r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME");
|
|
|
|
+ }
|
|
|
|
+ return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int write_data_other(void) {
|