summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gensignkey.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gensignkey.c b/gensignkey.c
index 8317fea..34b6f5a 100644
--- a/gensignkey.c
+++ b/gensignkey.c
@@ -152,6 +152,10 @@ int signkey_generate(enum signkey_type keytype, int bits, const char* filename,
}
}
+ /* 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);