* [PATCH] Fix compiler error in tgtd.c call_program
@ 2017-06-03 21:33 Andy Grover
2017-06-03 23:30 ` FUJITA Tomonori
0 siblings, 1 reply; 2+ messages in thread
From: Andy Grover @ 2017-06-03 21:33 UTC (permalink / raw)
To: stgt
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix compiler error in tgtd.c call_program
2017-06-03 21:33 [PATCH] Fix compiler error in tgtd.c call_program Andy Grover
@ 2017-06-03 23:30 ` FUJITA Tomonori
0 siblings, 0 replies; 2+ messages in thread
From: FUJITA Tomonori @ 2017-06-03 23:30 UTC (permalink / raw)
To: agrover; +Cc: stgt
On Sat, 3 Jun 2017 14:33:59 -0700
Andy Grover <agrover@redhat.com> wrote:
> 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(-)
Looks good, applied. Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-03 23:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-03 21:33 [PATCH] Fix compiler error in tgtd.c call_program Andy Grover
2017-06-03 23:30 ` FUJITA Tomonori
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 NNTP newsgroup(s).