From 23748ccbcd27047b32e322163349528aea671bb2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 14 Nov 2014 21:13:32 +0100 Subject: fix --check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/common.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common.c b/src/common.c index 051e32f..c6ca7f1 100644 --- a/src/common.c +++ b/src/common.c @@ -333,15 +333,14 @@ static int check_checksums(const char* restrict filename, const libkeccak_spec_t else if (got == 0) break; else ptr += (size_t)got; } - size = ptr; - close(fd), fd = -1; - if (ptr == size) { - if (new = realloc(buf, size += 1), new == NULL) + if (new = realloc(buf, size + 1), new == NULL) goto pfail; buf = new; } + size = ptr; + close(fd), fd = -1; buf[size++] = '\n'; for (ptr = 0, stage = 0; ptr < size; ptr++) @@ -358,7 +357,7 @@ static int check_checksums(const char* restrict filename, const libkeccak_spec_t hash_end = ptr, stage = 3; else { - rc = USER_ERROR("file is malformated"); /* FIXME error at end of file! c is zero! why!? */ + rc = USER_ERROR("file is malformated"); goto fail; } } -- cgit v1.2.3-70-g09d2