fix posix_spawn interaction with fork and abort by taking lock
[musl.git] / src / process / execle.c
blob37ca50349ac21db3d4789688046e31da0b16b57a
1 #include <unistd.h>
2 #include <stdarg.h>
4 int execle(const char *path, const char *argv0, ...)
6 int argc;
7 va_list ap;
8 va_start(ap, argv0);
9 for (argc=1; va_arg(ap, const char *); argc++);
10 va_end(ap);
12 int i;
13 char *argv[argc+1];
14 char **envp;
15 va_start(ap, argv0);
16 argv[0] = (char *)argv0;
17 for (i=1; i<=argc; i++)
18 argv[i] = va_arg(ap, char *);
19 envp = va_arg(ap, char **);
20 va_end(ap);
21 return execve(path, argv, envp);