diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-04-25 06:40:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 06:40:58 +0200 |
commit | d45a846e5ca313e5ab132ef57c495cc0407b50d9 (patch) | |
tree | 8e0e953356d2bd23d8238120f14b1acf953f5dc1 | |
parent | Merge pull request #11064 from opensourcerouting/fix/allow_only_euid_0_runnin... (diff) | |
parent | lib: Ensure an empty string does not get printed for host/domain (diff) | |
download | frr-d45a846e5ca313e5ab132ef57c495cc0407b50d9.tar.xz frr-d45a846e5ca313e5ab132ef57c495cc0407b50d9.zip |
Merge pull request #11067 from donaldsharp/domainname
lib: Ensure an empty string does not get printed for host/domain
-rw-r--r-- | lib/command.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/command.c b/lib/command.c index 1989668bf..a42951005 100644 --- a/lib/command.c +++ b/lib/command.c @@ -445,11 +445,15 @@ static bool full_cli; /* This function write configuration of this host. */ static int config_write_host(struct vty *vty) { - if (cmd_hostname_get()) - vty_out(vty, "hostname %s\n", cmd_hostname_get()); + const char *name; - if (cmd_domainname_get()) - vty_out(vty, "domainname %s\n", cmd_domainname_get()); + name = cmd_hostname_get(); + if (name && name[0] != '\0') + vty_out(vty, "hostname %s\n", name); + + name = cmd_domainname_get(); + if (name && name[0] != '\0') + vty_out(vty, "domainname %s\n", name); /* The following are all configuration commands that are not sent to * watchfrr. For instance watchfrr is hardcoded to log to syslog so |