From: Joel Rosdahl Date: Mon, 15 Sep 2025 19:26:04 +0000 (+0200) Subject: fix: Correct saving of current position in fallocate fallback code X-Git-Tag: v4.12.1~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e15ad0c71637ba76acf7390db47c27749c32ffa;p=thirdparty%2Fccache.git fix: Correct saving of current position in fallocate fallback code (cherry picked from commit af0731a6a2dd3622fd1307ba3baac22dffbfede6) --- diff --git a/src/ccache/util/file.cpp b/src/ccache/util/file.cpp index 61950b5b..d8f1cb55 100644 --- a/src/ccache/util/file.cpp +++ b/src/ccache/util/file.cpp @@ -239,7 +239,7 @@ fallocate(int fd, size_t new_size) // The underlying filesystem does not support the operation so fall back to // lseek. #endif - off_t saved_pos = lseek(fd, 0, SEEK_END); + off_t saved_pos = lseek(fd, 0, SEEK_CUR); off_t old_size = lseek(fd, 0, SEEK_END); if (old_size == -1) { int err = errno;