From 8494c1c0a207c3c4aa46f654c5f08238e1507d31 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 18 Jul 2016 14:38:59 +0200 Subject: bug fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/coopgammad.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/coopgammad.c b/src/coopgammad.c index 8cbc616..48891a4 100644 --- a/src/coopgammad.c +++ b/src/coopgammad.c @@ -537,16 +537,15 @@ static int unmarshal_and_merge_state(const char* restrict statefile) fd = open(statefile, O_RDONLY); if (fd < 0) goto fail; + + old_outputs = outputs, outputs = NULL; + old_outputs_n = outputs_n, outputs_n = 0; + if (!(marshalled = nread(fd, &n))) goto fail; close(fd), fd = -1; unlink(statefile), statefile = NULL; - old_outputs = outputs; - old_outputs_n = outputs_n; - outputs = NULL; - outputs_n = 0; - r = unmarshal(marshalled); if (r == 0) goto fail; -- cgit v1.2.3-70-g09d2