Commit c4ffc8f7 by Ken-ichirou MATSUZAWA Committed by Daniel Lezcano

initialize lxc_fd_list before WARN return path

We should initialize lxc_fd_list before opendir in __lxc_fd_collect_inherited in case of opendir returns error. Signed-off-by: 's avatarKen-ichirou MATSUZAWA <chamas@h4.doin.ne.jp> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent aa8b31f6
...@@ -145,6 +145,8 @@ static void __attribute__((constructor)) __lxc_fd_collect_inherited(void) ...@@ -145,6 +145,8 @@ static void __attribute__((constructor)) __lxc_fd_collect_inherited(void)
int fd, fddir; int fd, fddir;
DIR *dir; DIR *dir;
lxc_list_init(&lxc_fd_list);
dir = opendir("/proc/self/fd"); dir = opendir("/proc/self/fd");
if (!dir) { if (!dir) {
WARN("failed to open directory: %s", strerror(errno)); WARN("failed to open directory: %s", strerror(errno));
...@@ -153,8 +155,6 @@ static void __attribute__((constructor)) __lxc_fd_collect_inherited(void) ...@@ -153,8 +155,6 @@ static void __attribute__((constructor)) __lxc_fd_collect_inherited(void)
fddir = dirfd(dir); fddir = dirfd(dir);
lxc_list_init(&lxc_fd_list);
while (!readdir_r(dir, &dirent, &direntp)) { while (!readdir_r(dir, &dirent, &direntp)) {
if (!direntp) if (!direntp)
......
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