Fixed `NO_ENV` passing bad `envp` to `execve()`. Fixed `NO_SEARCH_PATH` compiler warnings.

Fortune for sink's current commit: Future small blessing − 末小吉
master
Avril 2 years ago
parent 6eb20eeb46
commit e1aa693e75
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -36,6 +36,7 @@ static inline int dupall(int from)
return 0;
}
#ifndef NO_SEARCH_PATH
inline static int err_not_found(int er) {
return er == ENOENT;
}
@ -69,13 +70,14 @@ static int path_lookup(size_t sz; const char name[restrict static 1], char fullp
free(_tmpfree);
return found;
}
#endif // !NO_SEARCH_PATH
int main(int argc, char** argv, char** envp)
{
(void)argc;
#ifdef NO_ENV
#define GET_ENV ((char*[]){})
(void)envp;
#define GET_ENV ((char*[]){NULL})
#else
#define GET_ENV envp
#endif
@ -100,7 +102,7 @@ int main(int argc, char** argv, char** envp)
if(argv[1]) {
#if NO_SEARCH_PATH
#ifdef NO_SEARCH_PATH
if(UNLIKELY($execve(argv[1]) < 0)) {
perror("execve() failed");
return errno;

Loading…
Cancel
Save