diff options
-rw-r--r-- | src/coopgammad.c | 9 |
1 files 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; |