Skip to content
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

fix: test case ut_lind_fs_mmap_no_read #67

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

ChinmayShringi
Copy link
Contributor

Description

Fixes # (issue)

This PR updates the ut_lind_fs_mmap_no_read test to correctly handle the mmap_syscall failure case when a file is opened with write-only permissions (O_WRONLY) and then an attempt is made to map the file with read permissions (PROT_READ | PROT_WRITE). The previous test directly checked the return value of mmap_syscall, which was incorrect. System calls typically return -1 on failure, and the specific error code (EACCES in this case) is stored in errno.

Changes:

  • Modified the test to check that mmap_syscall returns -1 to indicate failure.
  • Added an additional check to ensure that errno is set to EACCES, which represents "Permission denied" due to the lack of read permissions on the file.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • cargo test ut_lind_fs_mmap_no_read

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been added to a pull request and/or merged in other modules (native-client, lind-glibc, lind-project)

@Yaxuan-w Yaxuan-w merged commit 039978e into main Oct 23, 2024
1 check failed
@Yaxuan-w Yaxuan-w deleted the fix-ut-lind-fs-mmap-no-read branch October 25, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants