Commit 280b9e36 authored by Pavel Emelyanov's avatar Pavel Emelyanov

inotify: Sanitize watches adding loop

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d092c5ae
...@@ -245,7 +245,7 @@ err: ...@@ -245,7 +245,7 @@ err:
static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info) static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info)
{ {
InotifyWdEntry *iwe = info->iwe; InotifyWdEntry *iwe = info->iwe;
int ret = -1, wd, target = -1; int ret = -1, target = -1;
char buf[32], *path; char buf[32], *path;
path = get_mark_path("inotify", info->remap, iwe->f_handle, path = get_mark_path("inotify", info->remap, iwe->f_handle,
...@@ -259,8 +259,9 @@ static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info) ...@@ -259,8 +259,9 @@ static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info)
* this is suboptimal, but the kernel doesn't * this is suboptimal, but the kernel doesn't
* provide and API for this yet :( * provide and API for this yet :(
*/ */
wd = 1; while (1) {
while (wd >= 0) { int wd;
wd = inotify_add_watch(inotify_fd, path, iwe->mask); wd = inotify_add_watch(inotify_fd, path, iwe->mask);
if (wd < 0) { if (wd < 0) {
pr_perror("Can't add watch for %d with %d", inotify_fd, iwe->wd); pr_perror("Can't add watch for %d with %d", inotify_fd, iwe->wd);
......
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