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:
Jōshin 2023-12-16 14:11:24 -05:00
parent c0bbc45268
commit e36d5d4fa2
No known key found for this signature in database

View file

@ -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)) {