Skip to content
Snippets Groups Projects
Verified Commit d0b9dcd4 authored by Jeremy Soller's avatar Jeremy Soller Committed by Jeremy Soller
Browse files

Don't forget to close executable file

parent 21a5ccba
No related branches found
No related tags found
No related merge requests found
......@@ -316,7 +316,7 @@ macro_rules! t {
};
let fd = if let Some(program) = program_opt {
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");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment