From: Ruoyu <liangry@ucweb.com>
To: stgt@vger.kernel.org
Cc: Ruoyu <liangry@ucweb.com>
Subject: [PATCH] bs_rbd: fix error assignment in if condition
Date: Wed, 23 Jul 2014 10:38:34 +0800 [thread overview]
Message-ID: <1406083114-28024-1-git-send-email-liangry@ucweb.com> (raw)
The statement
if ((x == f()) < 0) {}
is strange. I think it should be
if ((x = f()) < 0) {}
For the reasone of coding style, I modify it as
x = f();
if (x < 0) {}
Signed-off-by: Ruoyu <liangry@ucweb.com>
---
usr/bs_rbd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/bs_rbd.c b/usr/bs_rbd.c
index 3a052ed..ef14797 100644
--- a/usr/bs_rbd.c
+++ b/usr/bs_rbd.c
@@ -431,8 +431,8 @@ static int bs_rbd_open(struct scsi_lu *lu, char *path, int *fd, uint64_t *size)
eprintf("bs_rbd_open: pool: %s image: %s snap: %s\n",
poolname, imagename, snapname);
- if ((ret == rados_ioctx_create(rbd->cluster, poolname, &rbd->ioctx))
- < 0) {
+ ret = rados_ioctx_create(rbd->cluster, poolname, &rbd->ioctx);
+ if (ret < 0) {
eprintf("bs_rbd_open: rados_ioctx_create: %d\n", ret);
return -EIO;
}
--
1.8.3.2
next reply other threads:[~2014-07-23 2:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 2:38 Ruoyu [this message]
2014-07-25 7:31 ` [PATCH] bs_rbd: fix error assignment in if condition FUJITA Tomonori
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=1406083114-28024-1-git-send-email-liangry@ucweb.com \
--to=liangry@ucweb.com \
--cc=stgt@vger.kernel.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).