logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 074ba11fffe5b3eb6110b819e60d65523d4c60cd
parent 20661a8683124d5215ecfdf8c25748fecb710834
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 11 Jun 2025 20:45:27 +0200

lib/fs: Only call file_sync at end of auto_fd_copy()

Diffstat:

Mlib/fs.c8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/fs.c b/lib/fs.c @@ -157,11 +157,11 @@ auto_fd_copy(int fd_in, int fd_out, size_t len) wrote += ret; len -= ret; - if(file_sync(fd_out) < 0) return -1; - - if(ret == 0) return wrote; + if(ret == 0) break; } - return -1; + if(file_sync(fd_out) < 0) return -1; + + return wrote; } #endif // HAS_SENDFILE \ No newline at end of file