summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util/util_file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 0275e78c54..7466004e5c 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -380,6 +380,7 @@ _PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length)
return false;
}
if (write(fd, packet, length) != (size_t)length) {
+ close(fd);
return false;
}
close(fd);