mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-07 10:20:29 +00:00
Make ape-m1 not die on realpath error
The loader was dying after the first PATH component if the command was not found. :(
This commit is contained in:
parent
c0bbc45268
commit
e36d5d4fa2
1 changed files with 3 additions and 2 deletions
|
@ -325,10 +325,11 @@ static char AccessCommand(struct PathSearcher *ps, unsigned long pathlen) {
|
|||
memmove(ps->path + pathlen, ps->name, ps->namelen);
|
||||
ps->path[pathlen + ps->namelen] = 0;
|
||||
if (!realpath(ps->path, buf)) {
|
||||
Pexit(ps->path, -errno, "realpath");
|
||||
return 0;
|
||||
}
|
||||
if ((n = strlen(buf)) >= sizeof(ps->path)) {
|
||||
Pexit(buf, 0, "too long");
|
||||
Perror(buf, 0, "too long");
|
||||
return 0;
|
||||
}
|
||||
memcpy(ps->path, buf, n + 1);
|
||||
if (!access(ps->path, X_OK)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue