From: Cyril Hrubis <chrubis@suse.cz>
To: Zorro Lang <zlang@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] diotest: set errno with zero before test with zero
Date: Mon, 8 Dec 2014 14:43:10 +0100 [thread overview]
Message-ID: <20141208134309.GC13319@rei.suse.de> (raw)
In-Reply-To: <1417776470-12961-1-git-send-email-zlang@redhat.com>
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
chrubis@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
prev parent reply other threads:[~2014-12-08 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 10:47 [LTP] [PATCH] diotest: set errno with zero before test with zero Zorro Lang
2014-12-08 11:53 ` Cyril Hrubis
[not found] ` <648997700.14823290.1418040193631.JavaMail.zimbra@redhat.com>
2014-12-08 12:13 ` Cyril Hrubis
2014-12-08 13:43 ` Cyril Hrubis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141208134309.GC13319@rei.suse.de \
--to=chrubis@suse.cz \
--cc=ltp-list@lists.sourceforge.net \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox