diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-04-06 14:52:04 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-04-06 16:26:13 +0200 |
commit | f05bc513bc0e0a977e6393e859cecbec77b420c6 (patch) | |
tree | c5b039f996b8206191d8faf02371774996662f2f | |
parent | 82bc93447bcf4bdb4c3835a2d7b1aae2240b5ac1 (diff) |
Avoid prompting error on empty line
Change-Id: I9da7f17f93f1948da23f6a2304f0718d7bee6464
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-client-demo.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/afb-client-demo.c b/src/afb-client-demo.c index 4f8882e2..434c6d17 100644 --- a/src/afb-client-demo.c +++ b/src/afb-client-demo.c @@ -222,9 +222,10 @@ static int io_event_callback(sd_event_source *src, int fd, uint32_t revents, voi rest[0] = i; while(i < count && line[i] != '\n') i++; rest[1] = i; if (i == count) break; line[i++] = 0; - if (api[0] == api[1] || verb[0] == verb[1]) - fprintf(stderr, "bad line: %s\n", line+pos); - else { + if (api[0] == api[1] || verb[0] == verb[1]) { + if (api[0] != api[1] || verb[0] != verb[1]) + fprintf(stderr, "bad line: %s\n", line+pos); + } else { line[api[1]] = line[verb[1]] = 0; emit(line + api[0], line + verb[0], line + rest[0]); } |