Commit 1bc6fec5 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

inotify: Don't forget to close opened files on error path

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1bebe80c
...@@ -111,8 +111,8 @@ int dump_inotify(struct fd_parms *p, int lfd, const struct cr_fdset *set) ...@@ -111,8 +111,8 @@ int dump_inotify(struct fd_parms *p, int lfd, const struct cr_fdset *set)
static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe) static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe)
{ {
char path[32]; char path[32];
int mntfd, ret = -1; int mntfd = -1, ret = -1;
int wd, target; int wd, target = -1;
fh_t handle = { }; fh_t handle = { };
/* syscall waits for strict structure here */ /* syscall waits for strict structure here */
...@@ -133,7 +133,7 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe) ...@@ -133,7 +133,7 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe)
if (target < 0) { if (target < 0) {
pr_perror("Can't open file handle for 0x%08x:0x%016lx", pr_perror("Can't open file handle for 0x%08x:0x%016lx",
iwe->s_dev, iwe->i_ino); iwe->s_dev, iwe->i_ino);
return -1; goto err;
} }
snprintf(path, sizeof(path), "/proc/self/fd/%d", target); snprintf(path, sizeof(path), "/proc/self/fd/%d", target);
...@@ -162,9 +162,9 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe) ...@@ -162,9 +162,9 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe)
inotify_rm_watch(inotify_fd, wd); inotify_rm_watch(inotify_fd, wd);
} }
close(mntfd); err:
close(target); close_safe(&mntfd);
close_safe(&target);
return ret; return ret;
} }
......
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