vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 293e6454d7153c518834e24479c9486d9336a7a0 parent 781de2e66b803483223645685f1eaa58c2a719be Author: Marc André Tanner <mat@brain-dump.org> Date: Sun, 26 Jan 2020 15:46:57 +0100 text: ignore fsync(2) errors on unsupported directory descriptors When saving a file by atomically renaming it to its final destination, we fsync(2) the parent directory to make sure the new directory entry is persisted. However, not all file systems support fsync on file descriptors referring to directories. As a result the save operation fails and subsequent attempts result in warnings regarding outdated file content, even though the data has most likely been successfully written. Ignoring this particular error seems fine, because it is a permanent limitation of the file system and not a temporary failure. Fixes #792 Diffstat:
| M | text.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/text.c b/text.c @@ -921,7 +921,7 @@ static bool text_save_commit_atomic(TextSave *ctx) { if (dir == -1) return false; - if (fsync(dir) == -1) { + if (fsync(dir) == -1 && errno != EINVAL) { close(dir); return false; }