]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Correct saving of current position in fallocate fallback code
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 15 Sep 2025 19:26:04 +0000 (21:26 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 1 Oct 2025 18:12:16 +0000 (20:12 +0200)
(cherry picked from commit af0731a6a2dd3622fd1307ba3baac22dffbfede6)

src/ccache/util/file.cpp

index 61950b5ba122e5ea98385d466db0f345f1b69d24..d8f1cb55e36d8abba332c4f188d1dc16de65b6d2 100644 (file)
@@ -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;