From: Rusty Russell Date: Sun, 6 Nov 2016 06:42:53 +0000 (+1030) Subject: ccanlint: check unused result. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=89fcdf8c701183e56d370876ec16a04ebbf921fb;hp=1ddb7420f1ac53c060aec62e26702d1d7029fc54 ccanlint: check unused result. GCC with -O gives an error here. Signed-off-by: Rusty Russell --- diff --git a/tools/ccanlint/tests/examples_exist.c b/tools/ccanlint/tests/examples_exist.c index 19d61a89..61359596 100644 --- a/tools/ccanlint/tests/examples_exist.c +++ b/tools/ccanlint/tests/examples_exist.c @@ -45,7 +45,10 @@ static char *add_example(struct manifest *m, struct ccan_file *source, /* Add #line to demark where we are from, so errors are correct! */ linemarker = tal_fmt(f, "#line %i \"%s\"\n", example->srcline+2, source->fullname); - write(fd, linemarker, strlen(linemarker)); + if (write(fd, linemarker, strlen(linemarker)) != (int)strlen(linemarker)) { + close(fd); + return cast_const(char *, "Failure writing to temporary file"); + } for (i = 0; i < example->num_lines; i++) { if (write(fd, example->lines[i], strlen(example->lines[i]))