Skip to content

Commit

Permalink
Merge pull request #1863 from brauner/2017-10-18/bugfixes
Browse files Browse the repository at this point in the history
confile: use correct check on char array
  • Loading branch information
stgraber committed Oct 18, 2017
2 parents de748b7 + 779b2d1 commit 29cdba5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/lxc/confile.c
Expand Up @@ -3357,12 +3357,12 @@ static int get_config_network_item(const char *key, char *retv, int inlen,
if (!netdev)
return -1;
if (strcmp(p1, "name") == 0) {
if (netdev->name)
if (netdev->name[0] != '\0')
strprint(retv, inlen, "%s", netdev->name);
} else if (strcmp(p1, "type") == 0) {
strprint(retv, inlen, "%s", lxc_net_type_to_str(netdev->type));
} else if (strcmp(p1, "link") == 0) {
if (netdev->link)
if (netdev->link[0] != '\0')
strprint(retv, inlen, "%s", netdev->link);
} else if (strcmp(p1, "flags") == 0) {
if (netdev->flags & IFF_UP)
Expand Down Expand Up @@ -3404,7 +3404,7 @@ static int get_config_network_item(const char *key, char *retv, int inlen,
} else if (strcmp(p1, "veth.pair") == 0) {
if (netdev->type == LXC_NET_VETH) {
strprint(retv, inlen, "%s",
netdev->priv.veth_attr.pair
netdev->priv.veth_attr.pair[0] != '\0'
? netdev->priv.veth_attr.pair
: netdev->priv.veth_attr.veth1);
}
Expand Down
6 changes: 3 additions & 3 deletions src/lxc/confile_utils.c
Expand Up @@ -256,7 +256,7 @@ void lxc_log_configured_netdevs(const struct lxc_conf *conf)
switch (netdev->type) {
case LXC_NET_VETH:
TRACE("type: veth");
if (netdev->priv.veth_attr.pair)
if (netdev->priv.veth_attr.pair[0] != '\0')
TRACE("veth pair: %s",
netdev->priv.veth_attr.pair);
if (netdev->priv.veth_attr.veth1[0] != '\0')
Expand Down Expand Up @@ -291,9 +291,9 @@ void lxc_log_configured_netdevs(const struct lxc_conf *conf)
}

TRACE("flags: %s", netdev->flags == IFF_UP ? "up" : "none");
if (netdev->link)
if (netdev->link[0] != '\0')
TRACE("link: %s", netdev->link);
if (netdev->name)
if (netdev->name[0] != '\0')
TRACE("name: %s", netdev->name);
if (netdev->hwaddr)
TRACE("hwaddr: %s", netdev->hwaddr);
Expand Down

0 comments on commit 29cdba5

Please sign in to comment.