12
12
#include <unistd.h>
13
13
#include <dlfcn.h>
14
14
#include <spawn.h>
15
+ #include <assert.h>
15
16
16
17
static int (* execl_orig )(const char * filename , const char * arg , ...);
17
18
static int (* execlp_orig )(const char * filename , const char * arg , ...);
@@ -50,6 +51,11 @@ __attribute__((constructor)) static void init()
50
51
_IO_popen_orig = dlsym (RTLD_NEXT , "_IO_popen" );
51
52
posix_spawn_orig = dlsym (RTLD_NEXT , "posix_spawn" );
52
53
posix_spawnp_orig = dlsym (RTLD_NEXT , "posix_spawnp" );
54
+
55
+ assert (execl_orig != execl );
56
+ assert (execv_orig != execv );
57
+ assert (execvp_orig != execvp );
58
+ assert (execvpe_orig != execvpe );
53
59
}
54
60
55
61
#define PRINT_CMD () \
@@ -168,7 +174,7 @@ int posix_spawn(pid_t *pid, const char *file,
168
174
char * const argv [], char * const envp [])
169
175
{
170
176
DECLARE_ARGS ();
171
- return posix_spawn_orig (pid , file , file_actions , attrp , argv , envp );
177
+ return posix_spawn_orig (pid , file , file_actions , attrp , args , envp );
172
178
}
173
179
174
180
int posix_spawnp (pid_t * pid , const char * file ,
@@ -177,5 +183,5 @@ int posix_spawnp(pid_t *pid, const char *file,
177
183
char * const argv [], char * const envp [])
178
184
{
179
185
DECLARE_ARGS ();
180
- return posix_spawnp_orig (pid , file , file_actions , attrp , argv , envp );
186
+ return posix_spawnp_orig (pid , file , file_actions , attrp , args , envp );
181
187
}
0 commit comments