changeset 1658:7402218141d4

bring back fsync_parent_dir
author Matt Johnston <matt@ucc.asn.au>
date Fri, 18 Oct 2019 23:48:16 +0800
parents 823592f244c9
children d32bcb5c557d
files gensignkey.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gensignkey.c	Tue Sep 17 22:26:03 2019 +0800
+++ b/gensignkey.c	Fri Oct 18 23:48:16 2019 +0800
@@ -152,6 +152,10 @@
 		}
 	}
 
+	/* ensure directory update is flushed to disk, otherwise we can end up
+	with zero-byte hostkey files if the power goes off */
+	fsync_parent_dir(filename);
+
 out:
 	if (buf) {
 		buf_burn(buf);