Skip to content

Fix location of printing out error message in utils_mmap_file() #896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/utils/utils_linux_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ void *utils_mmap_file(void *hint_addr, size_t length, int prot, int flags,
return addr;
}

LOG_PERR("mapping file with the MAP_SYNC flag failed (fd=%i, offset=%zu, "
"length=%zu, flags=%i)",
fd, fd_offset, length, sync_flags);

/* try to mmap with MAP_SHARED flag (without MAP_SYNC) */
if (errno == EINVAL || errno == ENOTSUP || errno == EOPNOTSUPP) {
const int shared_flags = flags | MAP_SHARED;
Expand All @@ -104,6 +100,11 @@ void *utils_mmap_file(void *hint_addr, size_t length, int prot, int flags,
LOG_PERR("mapping file with the MAP_SHARED flag failed (fd=%i, "
"offset=%zu, length=%zu, flags=%i)",
fd, fd_offset, length, shared_flags);
} else {
LOG_PERR(
"mapping file with the MAP_SYNC flag failed (fd=%i, offset=%zu, "
"length=%zu, flags=%i)",
fd, fd_offset, length, sync_flags);
}

return NULL;
Expand Down
Loading