about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/shims/wrong_fixed_arg_count.rs
blob: e9cb69418d22fc0b89b40825d8531002cd24d98f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//@ignore-target: windows # File handling is not implemented yet
//@compile-flags: -Zmiri-disable-isolation
use std::ffi::{CString, OsStr, c_char, c_int};
use std::os::unix::ffi::OsStrExt;

extern "C" {
    fn open(path: *const c_char, ...) -> c_int;
}

fn main() {
    let c_path = CString::new(OsStr::new("./text").as_bytes()).expect("CString::new failed");
    let _fd = unsafe {
        open(c_path.as_ptr(), /* value does not matter */ 0)
        //~^ ERROR: incorrect number of fixed arguments for variadic function
    };
}