2727#include <sys/cdefs.h>
2828__FBSDID ("$FreeBSD$" );
2929
30- #include "namespace.h"
3130#include <sys/queue.h>
3231#include <sys/wait.h>
3332
3433#include <errno.h>
3534#include <fcntl.h>
3635#include <sched.h>
37- #include < spawn.h>
36+ #include " spawn.h"
3837#include <signal.h>
3938#include <stdlib.h>
4039#include <string.h>
4140#include <unistd.h>
42- #include "un-namespace.h"
43- #include "libc_private.h"
4441
4542extern char * * environ ;
4643
@@ -85,6 +82,7 @@ typedef struct __posix_spawn_file_actions_entry {
8582static int
8683process_spawnattr (const posix_spawnattr_t sa )
8784{
85+ #if 0
8886 struct sigaction sigact = { .sa_flags = 0 , .sa_handler = SIG_DFL };
8987 int i ;
9088
@@ -133,6 +131,7 @@ process_spawnattr(const posix_spawnattr_t sa)
133131 return (errno );
134132 }
135133 }
134+ #endif
136135
137136 return (0 );
138137}
@@ -145,30 +144,30 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
145144 switch (fae -> fae_action ) {
146145 case FAE_OPEN :
147146 /* Perform an open(), make it use the right fd */
148- fd = _open (fae -> fae_path , fae -> fae_oflag , fae -> fae_mode );
147+ fd = open (fae -> fae_path , fae -> fae_oflag , fae -> fae_mode );
149148 if (fd < 0 )
150149 return (errno );
151150 if (fd != fae -> fae_fildes ) {
152- if (_dup2 (fd , fae -> fae_fildes ) == -1 )
151+ if (dup2 (fd , fae -> fae_fildes ) == -1 )
153152 return (errno );
154- if (_close (fd ) != 0 ) {
153+ if (close (fd ) != 0 ) {
155154 if (errno == EBADF )
156155 return (EBADF );
157156 }
158157 }
159- if (_fcntl (fae -> fae_fildes , F_SETFD , 0 ) == -1 )
158+ if (fcntl (fae -> fae_fildes , F_SETFD , 0 ) == -1 )
160159 return (errno );
161160 break ;
162161 case FAE_DUP2 :
163162 /* Perform a dup2() */
164- if (_dup2 (fae -> fae_fildes , fae -> fae_newfildes ) == -1 )
163+ if (dup2 (fae -> fae_fildes , fae -> fae_newfildes ) == -1 )
165164 return (errno );
166- if (_fcntl (fae -> fae_newfildes , F_SETFD , 0 ) == -1 )
165+ if (fcntl (fae -> fae_newfildes , F_SETFD , 0 ) == -1 )
167166 return (errno );
168167 break ;
169168 case FAE_CLOSE :
170169 /* Perform a close(), do not fail if already closed */
171- (void )_close (fae -> fae_fildes );
170+ (void )close (fae -> fae_fildes );
172171 break ;
173172 }
174173 return (0 );
@@ -198,7 +197,7 @@ do_posix_spawn(pid_t *pid, const char *path,
198197 pid_t p ;
199198 volatile int error = 0 ;
200199
201- p = vfork ();
200+ p = fork ();
202201 switch (p ) {
203202 case -1 :
204203 return (errno );
@@ -213,15 +212,15 @@ do_posix_spawn(pid_t *pid, const char *path,
213212 if (error )
214213 _exit (127 );
215214 }
216- if (use_env_path )
217- _execvpe (path , argv , envp != NULL ? envp : environ );
218- else
219- _execve (path , argv , envp != NULL ? envp : environ );
215+ // if (use_env_path)
216+ // execvpe (path, argv, envp != NULL ? envp : environ);
217+ // else
218+ execve (path , argv , envp != NULL ? envp : environ );
220219 error = errno ;
221220 _exit (127 );
222221 default :
223222 if (error != 0 )
224- _waitpid (p , NULL , WNOHANG );
223+ waitpid (p , NULL , WNOHANG );
225224 else if (pid != NULL )
226225 * pid = p ;
227226 return (error );
0 commit comments