commands: don't traverse whole list

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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent cfeeed19
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment