[LTP] [PATCH 2/2] inotify: Add SAFE_MYINOTIFY_ADD_WATCH() helper

Petr Vorel pvorel@suse.cz
Wed Jun 5 17:18:39 CEST 2019


Hi,

> > > If test exit with TBROK the reap_wd will never get a chance to set as 1,
> > > and the cleanup() also make no sense in tst_brk() calling.
> > No, that's a "flag" for cleanup function which is run always (no matter
> > whether
> > tst_brk() was called). See cleanup() and mount_flag in [1].


> You are right. And seems the problem is only exist in original code, it put
> reap_wd in wrong place and mislead my sight.

>        if ((wd = myinotify_add_watch(fd_notify, DIR_PATH, IN_ALL_EVENTS)) <
> 0) {
>                tst_brk(TBROK | TERRNO,
>                        "inotify_add_watch (%d, " DIR_PATH ", IN_ALL_EVENTS)
> failed",
>                        fd_notify);
>                reap_wd = 1;
>        };

so I'll put into commit message:

    Also put reap_wd to correct place in inotify0[127].c
    (in original code it was in if clause after tst_brk() so it was
    1) unreachable 2) for detection it should have been after if (outside).

    Fixes: 04f2177b6, inotify0[12].c, 763d02824 (inotify07.c)

Acked-by: Li Wang <liwang@redhat.com>

Kind regards,
Petr


More information about the ltp mailing list