diff options
-rw-r--r-- | nix-test/src/lib.rs | 2 | ||||
-rw-r--r-- | tests/unistd.rs | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/nix-test/src/lib.rs b/nix-test/src/lib.rs index a8be2feb..6cd3a1f4 100644 --- a/nix-test/src/lib.rs +++ b/nix-test/src/lib.rs @@ -16,7 +16,7 @@ mod ffi { pub fn assert_errno_eq(err: &str, val: c_int) { unsafe { - let name = CString::from_slice(err.as_bytes()); + let name = CString::new(err).unwrap(); let actual = ffi::assert_errno_eq(name.as_ptr()); assert!(actual > 0); diff --git a/tests/unistd.rs b/tests/unistd.rs index ee7de170..7a5d34e1 100644 --- a/tests/unistd.rs +++ b/tests/unistd.rs @@ -144,12 +144,12 @@ mod test { // Make `writer` be the stdout of the new process. dup(writer).unwrap(); // exec! - execve(&CString::from_slice(b"/bin/sh"), - &[CString::from_slice(b""), - CString::from_slice(b"-c"), - CString::from_slice(b"echo nix!!! && env")], - &[CString::from_slice(b"foo=bar"), - CString::from_slice(b"baz=quux")]).unwrap(); + execve(&CString::new(b"/bin/sh").unwrap(), + &[CString::new(b"").unwrap(), + CString::new(b"-c").unwrap(), + CString::new(b"echo nix!!! && env").unwrap()], + &[CString::new(b"foo=bar").unwrap(), + CString::new(b"baz=quux").unwrap()]).unwrap(); }, Parent(child_pid) => { // Wait for the child to exit. |