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 <ted@lyncon.se>
This commit is contained in:
Ted Lyngmo
2024-05-21 10:33:14 +08:00
committed by GitHub
parent 9ffc35c98e
commit e92363e248
+4 -1
View File
@@ -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);