Skip to content

Are we calling macOS "open" with a wrong argument type? #71915

Closed
@RalfJung

Description

@RalfJung

In this line, we are calling open64 (which on macOS is open renamed):

let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?;

As third argument, we are passing something of type c_int. However, according to this document, the type should be mode_t instead, and on macOS these types do not seem identical -- the libc crate has

src/unix/bsd/apple/mod.rs
10:pub type mode_t = u16;

Seems like we are using the wrong argument type here?
(open is variadic so the compiler cannot check this. But Miri complained when I started to check argument sizes.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-macosOperating system: macOST-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions