Skip to content

Change the interface of openat(dirfd: RawFd, ...) to openat(dirfd: Option<RawFd>, ...) #1850

Closed
@SteveLauC

Description

@SteveLauC

Almost every xxxat() function takes an optional dirfd, except fcntl::openat(2) and Dir::openat()

pub fn openat<P: ?Sized + NixPath>(
    dirfd: RawFd,
    path: &P,
    oflag: OFlag,
    mode: Mode,
) -> Result<RawFd> 
pub fn openat<P: ?Sized + NixPath>(dirfd: RawFd, path: &P, oflag: OFlag, mode: sys::stat::Mode) -> Result<Self> {
    let fd = fcntl::openat(dirfd, path, oflag, mode)?;
    Dir::from_fd(fd)
}

Any reason why it does not take an Option<RawFd>?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions