take a reference to the dirfd in Fd::openat
Otherwise we cannot pass references to it unless the AsRawFd implementation was made for the reference itself rather than the type. Note that while this changes the public API, we have no users outside of this crate yet and no public releases, so I'm not doing a major version bump. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
2a43a45763
commit
39c5d8641b
@ -54,7 +54,7 @@ impl Fd {
|
||||
nix::fcntl::open(path, oflag, mode).map(Self)
|
||||
}
|
||||
|
||||
pub fn openat<D, P>(dirfd: D, path: &P, oflag: OFlag, mode: Mode) -> Result<Self, nix::Error>
|
||||
pub fn openat<D, P>(dirfd: &D, path: &P, oflag: OFlag, mode: Mode) -> Result<Self, nix::Error>
|
||||
where
|
||||
D: AsRawFd,
|
||||
P: ?Sized + NixPath,
|
||||
|
@ -317,7 +317,7 @@ fn create_path_at_do(
|
||||
|
||||
Some(Component::ParentDir) => {
|
||||
at = Fd::openat(
|
||||
at,
|
||||
&at,
|
||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"..\0") },
|
||||
OFlag::O_DIRECTORY,
|
||||
stat::Mode::empty(),
|
||||
@ -342,7 +342,7 @@ fn create_path_at_do(
|
||||
Err(e) => return Err(e.into()),
|
||||
Ok(_) => true,
|
||||
};
|
||||
at = Fd::openat(at, path, OFlag::O_DIRECTORY, stat::Mode::empty())?;
|
||||
at = Fd::openat(&at, path, OFlag::O_DIRECTORY, stat::Mode::empty())?;
|
||||
|
||||
if let (true, Some(opts)) = (created, opts) {
|
||||
if opts.owner.is_some() || opts.group.is_some() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user