[LTP] [PATCH] kmsg01: fix race in SEEK_SET 0 test

Cyril Hrubis chrubis@suse.cz
Mon Mar 6 09:29:35 CET 2017


Hi!
> > > +		/*
> > > +		 * Open 2 fds. Use fd1 to read seqno1, then seek to
> > > +		 * begininng and read seqno2. Use fd2 to check if
> > > +		 * first entry in buffer got overwritten. If so,
> > > +		 * we'll have to repeat the test.
> > > +		 */
> > > +		fd = SAFE_OPEN(cleanup, "/dev/kmsg", O_RDONLY | O_NONBLOCK);
> > > +		fd2 = SAFE_OPEN(cleanup, "/dev/kmsg", O_RDONLY | O_NONBLOCK);
> > > +
> > > +		if (read_msg_seqno(fd, &seqno[0]))
> > > +			goto close_fds;
> > > +
> > > +		if (lseek(fd, 0, SEEK_SET) == -1) {
> > > +			tst_resm(TFAIL|TERRNO, "SEEK_SET 0 failed");
> > > +			goto done;
> > 
> > I wonder if this should be tst_brkm() rather than tst_resm(), since as
> > it is we would end up printing the TFAIL message below, or am I
> > mistaken?
> 
> I can skip the TFAIL message below, but I find TFAIL here more fitting,
> because it is directly related to what's being tested. 

Sounds reasonable, let's go with that.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list