Skip to content

Commit

Permalink
Log the real reason for why posix_fadvise failed
Browse files Browse the repository at this point in the history
`reclaimFilePageCache` did not set `errno` but `rdbSaveInternal` which
is logging the error assumed it did. This makes sure `errno` is set.

Fixes redis#13245

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
  • Loading branch information
TedLyngmo committed May 3, 2024
1 parent f95031c commit fe7e602
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fe7e602

Please sign in to comment.