Skip to content

Commit

Permalink
Fix the return type of fsmount. (#962)
Browse files Browse the repository at this point in the history
The documentation for `fsmount` says that it returns an owned file
descriptor.

Fixes #959.
  • Loading branch information
sunfishcode committed Dec 6, 2023
1 parent c2e1182 commit 90513bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/backend/libc/mount/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ pub(crate) fn fsmount(
fs_fd: BorrowedFd<'_>,
flags: super::types::FsMountFlags,
attr_flags: super::types::MountAttrFlags,
) -> io::Result<()> {
) -> io::Result<OwnedFd> {
syscall! {
fn fsmount(
fs_fd: c::c_int,
flags: c::c_uint,
attr_flags: c::c_uint
) via SYS_fsmount -> c::c_int
}
unsafe { ret(fsmount(borrowed_fd(fs_fd), flags.bits(), attr_flags.bits())) }
unsafe { ret_owned_fd(fsmount(borrowed_fd(fs_fd), flags.bits(), attr_flags.bits())) }
}

#[cfg(linux_kernel)]
Expand Down
4 changes: 2 additions & 2 deletions src/backend/linux_raw/mount/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub(crate) fn fsmount(
fs_fd: BorrowedFd<'_>,
flags: super::types::FsMountFlags,
attr_flags: super::types::MountAttrFlags,
) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_fsmount, fs_fd, flags, attr_flags)) }
) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(syscall_readonly!(__NR_fsmount, fs_fd, flags, attr_flags)) }
}

#[cfg(feature = "mount")]
Expand Down
2 changes: 1 addition & 1 deletion src/mount/fsopen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn fsmount(
fs_fd: BorrowedFd<'_>,
flags: FsMountFlags,
attr_flags: MountAttrFlags,
) -> io::Result<()> {
) -> io::Result<OwnedFd> {
backend::mount::syscalls::fsmount(fs_fd, flags, attr_flags)
}

Expand Down

0 comments on commit 90513bc

Please sign in to comment.