commit 816dc65482b52c96c56a51b75215584b84eda1ee from: Stefan Sperling date: Sat Feb 16 12:45:15 2019 UTC check for errors from fsync(2) commit - 5ea74b5a394cdadfb08905818a3bd053c5e06dfb commit + 816dc65482b52c96c56a51b75215584b84eda1ee blob - 37c8744b87c5306d5226f968dcaefb4cc5bdd970 blob + 28e60df1feddc66aaa4be09871a80d53f3834ae8 --- lib/worktree.c +++ lib/worktree.c @@ -663,7 +663,10 @@ merge_blob(struct got_worktree *worktree, struct got_f overlapcnt > 0 ? GOT_STATUS_CONFLICT : GOT_STATUS_MERGE, path); - fsync(merged_fd); + if (fsync(merged_fd) != 0) { + err = got_error_from_errno(); + goto done; + } if (rename(merged_path, ondisk_path) != 0) { err = got_error_from_errno(); @@ -769,7 +772,10 @@ install_blob(struct got_worktree *worktree, struct got } } while (len != 0); - fsync(fd); + if (fsync(fd) != 0) { + err = got_error_from_errno(); + goto done; + } if (update) { if (rename(tmppath, ondisk_path) != 0) {