core/diff/apply: use unix.Syncfs

Use the Syncfs wrapper function defined in the golang.org/x/sys/unix
package instead of manually wrapping it in doSyncFs.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
Tobias Klauser 2024-04-09 15:12:43 +02:00
parent 406e9e84b4
commit 0ec14fdf8c
No known key found for this signature in database
GPG Key ID: 6F5040074CCC0D04

View File

@ -97,9 +97,9 @@ func doSyncFs(file string) error {
}
defer fd.Close()
_, _, errno := unix.Syscall(unix.SYS_SYNCFS, fd.Fd(), 0, 0)
if errno != 0 {
return fmt.Errorf("failed to syncfs for %s: %w", file, errno)
err = unix.Syncfs(int(fd.Fd()))
if err != nil {
return fmt.Errorf("failed to syncfs for %s: %w", file, err)
}
return nil
}