Skip to content

Commit

Permalink
lxc_user_nic: cleanup get_alloted()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Apr 6, 2021
1 parent f21078d commit c0a515a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/lxc/cmd/lxc_user_nic.c
Expand Up @@ -318,28 +318,28 @@ static int get_alloted(char *me, char *intype, char *link,
if (ret != 4)
continue;

if (strlen(name) == 0)
if (is_empty_string(name))
continue;

if (strcmp(name, me)) {
if (!strequal(name, me)) {
if (name[0] != '@')
continue;

if (!name_is_in_groupnames(name + 1, groups))
continue;
}

if (strcmp(type, intype))
if (!strequal(type, intype))
continue;

if (strcmp(link, br))
if (!strequal(link, br))
continue;

/* Found the user or group with the appropriate settings,
* therefore finish the search. What to do if there are more
* than one applicable lines? not specified in the docs. Since
* getline is implemented with realloc, we don't need to free
* line until exiting func.
/*
* Found the user or group with the appropriate settings,
* therefore finish the search. What to do if there are is more
* than one applicable line? Currently this is not specified in
* the docs.
*
* If append_alloted returns NULL, e.g. due to a malloc error,
* we set count to 0 and break the loop, allowing cleanup and
Expand Down

0 comments on commit c0a515a

Please sign in to comment.