]> 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>
Wed, 6 Dec 2017 15:01:19 +0000 (16:01 +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 5533829934e669d61679842f485e07bd3307ccd3..874a6f7911f48e471ccd65535f45e25fb9170a02 100644 (file)
@@ -1176,6 +1176,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();
 }