diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-14 15:34:46 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-07-16 11:27:40 +0200 |
commit | 88016b4980d5e8283872cfb0703c139a27b43ea6 (patch) | |
tree | 0fde55e4cf0e4d23084a98b57ef9041ac4bbedeb /crates/common/tedge_utils | |
parent | e9213bc9ec20e39d551987b7aa141d974f5e201c (diff) |
Fix: Flush the file buffer in the sync fn as well
Suggested-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
Diffstat (limited to 'crates/common/tedge_utils')
-rw-r--r-- | crates/common/tedge_utils/src/fs.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crates/common/tedge_utils/src/fs.rs b/crates/common/tedge_utils/src/fs.rs index 395a4c14..fff39647 100644 --- a/crates/common/tedge_utils/src/fs.rs +++ b/crates/common/tedge_utils/src/fs.rs @@ -18,6 +18,8 @@ pub fn atomically_write_file_sync( return Err(err); } + file.flush()?; + if let Err(err) = std_fs::rename(tempfile.as_ref(), dest) { let _ = std_fs::remove_file(tempfile); return Err(err); |