summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-27 16:06:33 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-27 16:06:33 -0400
commite6bac87d0eaab116878a04874bc5b6a3496cb938 (patch)
treef88a34682883b960faa59ed0f97e06ae882c2ea0 /src
parent22263709eda9f7d692a0f484fd759f757418dbd7 (diff)
downloadmusl-e6bac87d0eaab116878a04874bc5b6a3496cb938.tar.gz
musl-e6bac87d0eaab116878a04874bc5b6a3496cb938.tar.bz2
musl-e6bac87d0eaab116878a04874bc5b6a3496cb938.tar.xz
musl-e6bac87d0eaab116878a04874bc5b6a3496cb938.zip
correct variadic prototypes for execl* family
the old versions worked, but conflicted with programs which declared their own prototypes and generated warnings with some versions of gcc.
Diffstat (limited to 'src')
-rw-r--r--src/process/execl.c11
-rw-r--r--src/process/execle.c11
-rw-r--r--src/process/execlp.c11
3 files changed, 18 insertions, 15 deletions
diff --git a/src/process/execl.c b/src/process/execl.c
index 4c6eaa94..327d78b2 100644
--- a/src/process/execl.c
+++ b/src/process/execl.c
@@ -1,18 +1,19 @@
#include <unistd.h>
#include <stdarg.h>
-int execl(const char *path, ...)
+int execl(const char *path, const char *argv0, ...)
{
int argc;
va_list ap;
- va_start(ap, path);
- for (argc=0; va_arg(ap, const char *); argc++);
+ va_start(ap, argv0);
+ for (argc=1; va_arg(ap, const char *); argc++);
va_end(ap);
{
int i;
char *argv[argc+1];
- va_start(ap, path);
- for (i=0; i<argc; i++)
+ va_start(ap, argv0);
+ argv[0] = (char *)argv0;
+ for (i=1; i<argc; i++)
argv[i] = va_arg(ap, char *);
argv[i] = NULL;
return execv(path, argv);
diff --git a/src/process/execle.c b/src/process/execle.c
index 37f629d9..64908366 100644
--- a/src/process/execle.c
+++ b/src/process/execle.c
@@ -1,19 +1,20 @@
#include <unistd.h>
#include <stdarg.h>
-int execle(const char *path, ...)
+int execle(const char *path, const char *argv0, ...)
{
int argc;
va_list ap;
- va_start(ap, path);
- for (argc=0; va_arg(ap, const char *); argc++);
+ va_start(ap, argv0);
+ for (argc=1; va_arg(ap, const char *); argc++);
va_end(ap);
{
int i;
char *argv[argc+1];
char **envp;
- va_start(ap, path);
- for (i=0; i<argc; i++)
+ va_start(ap, argv0);
+ argv[0] = (char *)argv0;
+ for (i=1; i<argc; i++)
argv[i] = va_arg(ap, char *);
argv[i] = NULL;
envp = va_arg(ap, char **);
diff --git a/src/process/execlp.c b/src/process/execlp.c
index 33fb0f7f..c7b3f513 100644
--- a/src/process/execlp.c
+++ b/src/process/execlp.c
@@ -1,18 +1,19 @@
#include <unistd.h>
#include <stdarg.h>
-int execlp(const char *file, ...)
+int execlp(const char *file, const char *argv0, ...)
{
int argc;
va_list ap;
- va_start(ap, file);
- for (argc=0; va_arg(ap, const char *); argc++);
+ va_start(ap, argv0);
+ for (argc=1; va_arg(ap, const char *); argc++);
va_end(ap);
{
int i;
char *argv[argc+1];
- va_start(ap, file);
- for (i=0; i<argc; i++)
+ va_start(ap, argv0);
+ argv[0] = (char *)argv0;
+ for (i=1; i<argc; i++)
argv[i] = va_arg(ap, char *);
argv[i] = NULL;
return execvp(file, argv);