From a44e4fb63113f84e14c2d6669596ec763d024ca9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 15 Dec 2016 11:49:13 +1030 Subject: [PATCH] daemon/json, test/test_protocol: avoid gcc -O warnings. Signed-off-by: Rusty Russell --- daemon/json.c | 3 ++- test/test_protocol.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/daemon/json.c b/daemon/json.c index b536f476e..169869b97 100644 --- a/daemon/json.c +++ b/daemon/json.c @@ -226,7 +226,8 @@ bool json_get_params(const char *buffer, const jsmntok_t param[], ...) { va_list ap; const char *name; - const jsmntok_t **tokptr, *p, *end; + /* Uninitialized warnings on p and end */ + const jsmntok_t **tokptr, *p = NULL, *end = NULL; if (param->type == JSMN_ARRAY) { if (param->size == 0) diff --git a/test/test_protocol.c b/test/test_protocol.c index 593d553e9..c16b3c0d2 100644 --- a/test/test_protocol.c +++ b/test/test_protocol.c @@ -998,7 +998,9 @@ static void do_cmd(struct peer *peer) } else errx(1, "%s: Unknown command %s", peer->name, cmd); - write(peer->cmddonefd, peer->info, strlen(peer->info)+1); + if (write(peer->cmddonefd, peer->info, strlen(peer->info)+1) + != strlen(peer->info)+1) + abort(); /* We must always have (at least one) signed, unrevoked commit. */ for (ci = peer->local; ci; ci = ci->prev) {