Skip to content

Commit

Permalink
client: translate dot into the short hostname
Browse files Browse the repository at this point in the history
as documented in lldpcli(8):

    configure system hostname name

        Override system hostname with the provided value. By default, the
        system name is the FQDN found from the resolved value of uname
        -n.  As a special value, use "." (dot) to use the short hostname
        instead of a FQDN.
  • Loading branch information
gsauthof authored and vincentbernat committed Nov 24, 2023
1 parent 17fc741 commit b895508
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client/conf-system.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ cmd_hostname(struct lldpctl_conn_t *conn, struct writer *w, struct cmd_env *env,
lldpctl_atom_dec_ref(config);
return 0;
}
char *c = strchr(un.nodename, '.');
if (c)
*c = 0;
value = un.nodename;
}
if (lldpctl_atom_set_str(config, lldpctl_k_config_hostname, value) == NULL) {
Expand Down

0 comments on commit b895508

Please sign in to comment.