diff options
author | Mitesh Kanjariya <mitesh@cumulusnetworks.com> | 2017-08-26 00:26:33 +0200 |
---|---|---|
committer | Mitesh Kanjariya <mitesh@cumulusnetworks.com> | 2017-08-26 00:39:14 +0200 |
commit | 4a48f1b70b5afe6371fc188811c09541afd6008d (patch) | |
tree | 0ec5cb4a9494f9689a44bba46c3445f07372162e /lib | |
parent | provide/use API to get hostname/domainname (diff) | |
download | frr-4a48f1b70b5afe6371fc188811c09541afd6008d.tar.xz frr-4a48f1b70b5afe6371fc188811c09541afd6008d.zip |
lib: Fix make check failures
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/command.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c index 2d262c114..13fee70c6 100644 --- a/lib/command.c +++ b/lib/command.c @@ -130,6 +130,12 @@ struct host host; */ const char *hostname_get(void) { + struct utsname names; + + if (!host.name) { + uname(&names); + host.name = XSTRDUP(MTYPE_HOST, names.nodename); + } return host.name; } @@ -138,6 +144,12 @@ const char *hostname_get(void) */ const char *domainname_get(void) { + struct utsname names; + + if (!host.name || !host.domainname) { + uname(&names); + host.domainname = XSTRDUP(MTYPE_HOST, names.domainname); + } return host.domainname; } |