mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
Don't forget to close executable file
This commit is contained in:
@@ -318,7 +318,7 @@ macro_rules! t {
|
||||
};
|
||||
|
||||
let fd = if let Some(program) = program {
|
||||
t!(cvt(syscall::open(program.as_os_str().as_bytes(), syscall::O_RDONLY)))
|
||||
t!(cvt(syscall::open(program.as_os_str().as_bytes(), syscall::O_RDONLY | syscall::O_CLOEXEC)))
|
||||
} else {
|
||||
return io::Error::from_raw_os_error(syscall::ENOENT);
|
||||
};
|
||||
@@ -341,6 +341,7 @@ macro_rules! t {
|
||||
}
|
||||
|
||||
if let Err(err) = syscall::fexec(fd, &args, &vars) {
|
||||
let _ = syscall::close(fd);
|
||||
io::Error::from_raw_os_error(err.errno as i32)
|
||||
} else {
|
||||
panic!("return from exec without err");
|
||||
|
||||
Reference in New Issue
Block a user