mirror of
git://git.musl-libc.org/musl
synced 2024-12-14 18:55:23 +00:00
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.
This commit is contained in:
parent
22263709ed
commit
e6bac87d0e
@ -81,10 +81,10 @@ int pause(void);
|
||||
pid_t fork(void);
|
||||
int execve(const char *, char *const [], char *const []);
|
||||
int execv(const char *, char *const []);
|
||||
int execle(const char *, ...);
|
||||
int execl(const char *, ...);
|
||||
int execle(const char *, const char *, ...);
|
||||
int execl(const char *, const char *, ...);
|
||||
int execvp(const char *, char *const []);
|
||||
int execlp(const char *, ...);
|
||||
int execlp(const char *, const char *, ...);
|
||||
int fexecve(int, char *const [], char *const []);
|
||||
void _exit(int);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 **);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user