]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
commands: don't traverse whole list
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 22 Nov 2017 13:13:07 +0000 (14:13 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 17 Dec 2017 14:53:31 +0000 (15:53 +0100)
When we remove a state client fd there's not reason to walk the whole list. We
can simply break once we found and removed the fd.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c

index d1ffecf41254cc09c28b0d6a620689abb4aebaa5..0c3f4d7f62b1e9177dd93665a968bb135c9a48ad 100644 (file)
@@ -972,6 +972,10 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
                lxc_list_del(cur);
                free(cur->elem);
                free(cur);
+               /* No need to walk the whole list. If we found the state client
+                * fd there can't be a second one.
+                */
+               break;
        }
        process_unlock();
 }