File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -370,7 +370,7 @@ pub fn posix_spawn<SA: AsRef<CStr>, SE: AsRef<CStr>>(
370370) -> Result < Pid > {
371371 let mut pid = 0 ;
372372
373- let res = unsafe {
373+ let ret = unsafe {
374374 let args_p = to_exec_array ( args) ;
375375 let env_p = to_exec_array ( envp) ;
376376
@@ -384,7 +384,10 @@ pub fn posix_spawn<SA: AsRef<CStr>, SE: AsRef<CStr>>(
384384 )
385385 } ;
386386
387- Errno :: result ( res) ?;
387+ if ret != 0 {
388+ return Err ( Errno :: from_raw ( ret) ) ;
389+ }
390+
388391 Ok ( Pid :: from_raw ( pid) )
389392}
390393
@@ -399,7 +402,7 @@ pub fn posix_spawnp<SA: AsRef<CStr>, SE: AsRef<CStr>>(
399402) -> Result < Pid > {
400403 let mut pid = 0 ;
401404
402- let res = unsafe {
405+ let ret = unsafe {
403406 let args_p = to_exec_array ( args) ;
404407 let env_p = to_exec_array ( envp) ;
405408
@@ -413,6 +416,9 @@ pub fn posix_spawnp<SA: AsRef<CStr>, SE: AsRef<CStr>>(
413416 )
414417 } ;
415418
416- Errno :: result ( res) ?;
419+ if ret != 0 {
420+ return Err ( Errno :: from_raw ( ret) ) ;
421+ }
422+
417423 Ok ( Pid :: from_raw ( pid) )
418424}
You can’t perform that action at this time.
0 commit comments