All of lore.kernel.org
 help / color / mirror / Atom feed
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 12:53:50 +0100	[thread overview]
Message-ID: <20141208115349.GC11071@rei.suse.de> (raw)
In-Reply-To: <1417776470-12961-1-git-send-email-zlang@redhat.com>

Hi!
>     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;

As far as I can see this code tests that read() has returned negative
value and in this case errno must be set.

I.e.

if ret >= 0 -> read hasn't failed -> FAILURE

The errno != errnum is not evaluated unless the first condition has
failed (that means ret < 0) and in this case errno must be set.

The condition is equivalent to !(ret < 0 && errno == errnum)

Or am I missing something?

-- 
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

  reply	other threads:[~2014-12-08 11:54 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 [this message]
     [not found]   ` <648997700.14823290.1418040193631.JavaMail.zimbra@redhat.com>
2014-12-08 12:13     ` Cyril Hrubis
2014-12-08 13:43 ` Cyril Hrubis

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=20141208115349.GC11071@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.