From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] xfs_fsr: Fix parentheses around truth value
Date: Mon, 03 Aug 2015 20:30:36 -0700 [thread overview]
Message-ID: <55C031DC.6050404@redhat.com> (raw)
Someone in the distant past must have responded to gcc's
warning about parentheses around assignment used as a truth
value by changing:
while (ret = func() == 0)
to:
while ((ret = func() == 0))
While this shuts up gcc, it doesn't yield the proper result.
If func () returns 0, func == 0 is true, and ret is assigned
a value of 1.
This does keep the while loop going, but it's a very strange
way to go about it, and may someday yield confusing results.
Fix this as:
while ((ret = func()) == 0)
so that ret gets the function return value as expected.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index b46ad1f..b384565 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -716,7 +716,7 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange)
tmp_init(mntdir);
while ((ret = xfs_bulkstat(fsfd,
- &lastino, GRABSZ, &buf[0], &buflenout) == 0)) {
+ &lastino, GRABSZ, &buf[0], &buflenout)) == 0) {
xfs_bstat_t *p;
xfs_bstat_t *endp;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2015-08-04 3:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 3:30 Eric Sandeen [this message]
2015-08-04 11:17 ` [PATCH] xfs_fsr: Fix parentheses around truth value Christoph Hellwig
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=55C031DC.6050404@redhat.com \
--to=sandeen@redhat.com \
--cc=xfs@oss.sgi.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.