diff options
author | Matt Johnston <matt@ucc.asn.au> | 2019-10-18 23:48:16 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2019-10-18 23:48:16 +0800 |
commit | b2007beeb0203c8f9f3d6d07329d0d1fceea91c7 (patch) | |
tree | 632d46954cf3f4ff170a424c942beabfe65a5573 | |
parent | 8f123fb6185f67a018bd1c54bef38d2255d8597f (diff) |
bring back fsync_parent_dir
-rw-r--r-- | gensignkey.c | 4 |
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); |