Hi!
> some code logic in diotest4.c likes below:
> ----
>     ret = lseek(fd, offset, SEEK_SET);
>     if ((ret >= 0) || (errno != EINVAL)) {
>         tst_resm(TFAIL, "lseek allows negative offset. returns %d:%s", ret, 
> strerror(errno));
>         failed = TRUE;
>         fail_count++;
>     } else
>         tst_resm(TPASS, "Negative Offset");
> 
>     ....
>     ....
> 
>     ret = read(fd, buf, count);
>     if (ret >= 0 || errno != errnum) {
>         tst_resm(TFAIL, "read allows %s. returns %d: %s", msg, ret, 
> strerror(errno));
>         l_fail = TRUE;
>     }
> ----
> 
> If lseek() EINVAL and read() return >= 0, the errno will not be setted to 0. 
> The
> errno will still be EINVAL.
> 
> I hit this problem when test on nfs. In NFS, lseek() return EINVAL as 
> excepted,
> but the read() will return 1, when count = 1. But the errno is still EINVAL.
> That's incorrect.
> 
> So I set errno = 0, before read() and all other functions which like this.

Can you please clarify the commit message a bit so that it's clear that
it's the test failure message that is confusing in case that read()
haven't failed as expected and the errno is still set?

Otherwise it looks fine.

-- 
Cyril Hrubis
chru...@suse.cz

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to