[LTP] [PATCH 2/4] fanotify03: Add test cases for permission events on children
Jan Kara
jack@suse.cz
Wed Feb 12 13:35:11 CET 2025
On Tue 11-02-25 18:56:39, Petr Vorel wrote:
> Hi Amir, Jan,
>
> > On Mon, Feb 10, 2025 at 4:25 PM Jan Kara <jack@suse.cz> wrote:
>
> > > On Mon 10-02-25 16:13:14, Amir Goldstein wrote:
> > > > Verify that permission events are delivered iff parent is watching
> > > > children.
>
> > > > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>
> > > Overall looks ok but:
>
> > > > - if (read(fd, buf, BUF_SIZE) != -1)
> > > > + exp_ret = exp_errno ? -1 : 1;
> > > > + errno = 0;
> > > > + if (read(fd, buf, BUF_SIZE) != exp_ret || errno != exp_errno) {
> > > > + tst_res(TFAIL, "read() got errno %d (expected %d)", errno, exp_errno);
> > > > exit(3);
> > > > + } else if (errno == exp_errno) {
> > > ^^ Why is this condition needed? It is always true AFAICT.
>
> > > > + tst_res(TINFO, "read() got errno %d as expected", errno);
> > > > + }
>
> > > > SAFE_CLOSE(fd);
>
> > > > - if (execve(FILE_EXEC_PATH, argv, environ) != -1)
> > > > + exp_ret = exp_errno ? -1 : 0;
> > > > + errno = 0;
> > > > + if (execve(FILE_EXEC_PATH, argv, environ) != exp_ret || errno != exp_errno) {
> > > > + tst_res(TFAIL, "execve() got errno %d (expected %d)", errno, exp_errno);
> > > > exit(5);
> > > > + } else if (errno == exp_errno) {
> > > ^^^ and here as well...
>
> > > > + tst_res(TINFO, "execve() got errno %d as expected", errno);
>
> > You are right.
> > I was "backported" from the pre-content test.
> > The two else statements can be removed in this patch.
>
> FYI I'm going to merge with the diff below (discussed change).
>
> Jan, may I add your RBT?
Yes. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
More information about the ltp
mailing list