Convert fish_mkstemp_cloexec() to return an OwnedFd

This commit is contained in:
Mahmoud Al-Qudsi
2024-03-05 14:29:31 -06:00
parent cfe9881eaa
commit 58a6eb6e45
4 changed files with 49 additions and 58 deletions

View File

@@ -60,13 +60,8 @@ fn test_wdirname_wbasename() {
#[serial]
fn test_wwrite_to_fd() {
test_init();
let (fd, filename) =
fish_mkstemp_cloexec(CString::new("/tmp/fish_test_wwrite.XXXXXX").unwrap());
{
let mut tmpfd = AutoCloseFd::new(fd);
assert!(tmpfd.is_valid());
tmpfd.close();
}
let (_fd, filename) =
fish_mkstemp_cloexec(CString::new("/tmp/fish_test_wwrite.XXXXXX").unwrap()).unwrap();
let sizes = [1, 2, 3, 5, 13, 23, 64, 128, 255, 4096, 4096 * 2];
for &size in &sizes {
let fd = AutoCloseFd::new(unsafe {