From 2be94e68e8aeb7955aba9a5e317414040b90e619 Mon Sep 17 00:00:00 2001 From: Ted Lyngmo Date: Fri, 3 May 2024 20:10:33 +0200 Subject: [PATCH] Log the real reason for why posix_fadvise failed (#430) `reclaimFilePageCache` did not set `errno` but `rdbSaveInternal` which is logging the error assumed it did. This makes sure `errno` is set. 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 26d92b922..62d789be9 100644 --- a/src/util.c +++ b/src/util.c @@ -1138,7 +1138,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);