stgt.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Grover <agrover@redhat.com>
To: stgt@vger.kernel.org
Subject: [PATCH] Fix compiler error in tgtd.c call_program
Date: Sat,  3 Jun 2017 14:33:59 -0700	[thread overview]
Message-ID: <20170603213359.16089-1-agrover@redhat.com> (raw)

Using a newer version of gcc, we see an error:

tgtd.c:313:14: error: comparison between pointer and zero character
 constant [-Werror=pointer-compare]
   while (pos != '\0')
              ^~
tgtd.c:313:10: note: did you mean to dereference the pointer?
   while (pos != '\0')
          ^
I think gcc is right, so deref pos.

Signed-off-by: Andy Grover <agrover@redhat.com>
---
 usr/tgtd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/tgtd.c b/usr/tgtd.c
index 19c703d..ae2f489 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -310,7 +310,7 @@ int call_program(const char *cmd, void (*callback)(void *data, int result),
 	pos = arg;
 	str_spacecpy(&pos, cmd);
 	if (strchr(cmd, ' ')) {
-		while (pos != '\0')
+		while (*pos != '\0')
 			argv[i++] = strsep(&pos, " ");
 	} else
 		argv[i++] = arg;
-- 
2.9.4

             reply	other threads:[~2017-06-03 21:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03 21:33 Andy Grover [this message]
2017-06-03 23:30 ` [PATCH] Fix compiler error in tgtd.c call_program 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=20170603213359.16089-1-agrover@redhat.com \
    --to=agrover@redhat.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).