From e92363e248019b8bf3fc7dd8ce84f648b6b13473 Mon Sep 17 00:00:00 2001 From: Ted Lyngmo Date: Tue, 21 May 2024 04:33:14 +0200 Subject: [PATCH] Log the real reason for why posix_fadvise failed (#13246) `reclaimFilePageCache` did not set `errno` but `rdbSaveInternal` which is logging the error assumed it did. This makes sure `errno` is set. Fixes #13245 Signed-off-by: Ted Lyngmo --- src/util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index f8c3321a1d3c..98cd9ddf6407 100644 --- a/src/util.c +++ b/src/util.c @@ -1176,7 +1176,10 @@ int fsyncFileDir(const char *filename) { int reclaimFilePageCache(int fd, size_t offset, size_t length) { #ifdef HAVE_FADVISE int ret = posix_fadvise(fd, offset, length, POSIX_FADV_DONTNEED); - if (ret) return -1; + if (ret) { + errno = ret; + return -1; + } return 0; #else UNUSED(fd);