diff gensignkey.c @ 1658:7402218141d4

bring back fsync_parent_dir
author Matt Johnston <matt@ucc.asn.au>
date Fri, 18 Oct 2019 23:48:16 +0800
parents 4f8eb331174f
children d32bcb5c557d
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);