summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ctdb/tools/ctdb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index fa38e419781..196832962b6 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -5450,11 +5450,13 @@ static int control_tfetch(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
nwritten = sys_write(fd, data.dptr, data.dsize);
if (nwritten != data.dsize) {
fprintf(stderr, "Failed to write record to file\n");
+ close(fd);
goto fail;
}
close(fd);
}
+
fail:
ret = ctdb_ltdb_header_extract(&data, &header);
if (ret != 0) {