forked from pool/systemd
Accepting request 173532 from home:fcrozat:branches:Base:System
- Fix handle-etc-HOSTNAME.patch to properly set hostname at startup when using /etc/HOSTNAME. OBS-URL: https://build.opensuse.org/request/show/173532 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=372
This commit is contained in:
parent
0ce42fd6b6
commit
8e233bafe7
@ -4,9 +4,44 @@ Subject: handle /etc/HOSTNAME
|
||||
|
||||
(bnc#803653)
|
||||
---
|
||||
src/hostname/hostnamed.c | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
src/core/hostname-setup.c | 22 +++++++++++++++++-----
|
||||
src/hostname/hostnamed.c | 12 +++++++++++-
|
||||
2 files changed, 28 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
|
||||
index ac508af..15d206c 100644
|
||||
--- a/src/core/hostname-setup.c
|
||||
+++ b/src/core/hostname-setup.c
|
||||
@@ -61,12 +61,24 @@ int hostname_setup(void) {
|
||||
|
||||
r = read_and_strip_hostname("/etc/hostname", &b);
|
||||
if (r < 0) {
|
||||
- if (r == -ENOENT)
|
||||
- enoent = true;
|
||||
- else
|
||||
+ if (r == -ENOENT) {
|
||||
+ /* use SUSE fallback */
|
||||
+ r = read_and_strip_hostname("/etc/HOSTNAME", &b);
|
||||
+ if (r < 0) {
|
||||
+ if (r == -ENOENT)
|
||||
+ enoent = true;
|
||||
+ else
|
||||
+ log_warning("Failed to read configured hostname: %s", strerror(-r));
|
||||
+ hn = NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ hn = b;
|
||||
+
|
||||
+ }
|
||||
+ else {
|
||||
log_warning("Failed to read configured hostname: %s", strerror(-r));
|
||||
-
|
||||
- hn = NULL;
|
||||
+ hn = NULL;
|
||||
+ }
|
||||
} else
|
||||
hn = b;
|
||||
|
||||
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
|
||||
index c7f454c..cfbd706 100644
|
||||
--- a/src/hostname/hostnamed.c
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 26 16:37:28 CEST 2013 - fcrozat@suse.com
|
||||
|
||||
- Fix handle-etc-HOSTNAME.patch to properly set hostname at startup
|
||||
when using /etc/HOSTNAME.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 25 08:19:30 UTC 2013 - rmilasan@suse.com
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 26 16:37:28 CEST 2013 - fcrozat@suse.com
|
||||
|
||||
- Fix handle-etc-HOSTNAME.patch to properly set hostname at startup
|
||||
when using /etc/HOSTNAME.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 25 08:19:30 UTC 2013 - rmilasan@suse.com
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user