Skip to content

Commit c013030

Browse files
committed
execve should take a ref to a CString
1 parent b085013 commit c013030

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/unistd.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn chdir<S: ToCStr>(path: S) -> SysResult<()> {
125125
}
126126

127127
#[inline]
128-
pub fn execve(filename: CString, args: &[CString], env: &[CString]) -> SysResult<()> {
128+
pub fn execve(filename: &CString, args: &[CString], env: &[CString]) -> SysResult<()> {
129129
let mut args_p: Vec<*const c_char> = args.iter().map(|s| s.as_ptr()).collect();
130130
args_p.push(ptr::null());
131131

@@ -140,8 +140,7 @@ pub fn execve(filename: CString, args: &[CString], env: &[CString]) -> SysResult
140140
return Err(SysError::last());
141141
}
142142

143-
// Should never reach here
144-
Ok(())
143+
unreachable!()
145144
}
146145

147146
pub fn daemon(nochdir: bool, noclose: bool) -> SysResult<()> {

0 commit comments

Comments
 (0)