Save a scan of ps->name

This commit is contained in:
Jōshin 2024-01-07 08:55:38 -05:00
parent a13ea13b19
commit e7d3dc3aa7
No known key found for this signature in database

View file

@ -371,8 +371,8 @@ static char FindCommand(struct PathSearcher *ps) {
static char *Commandv(struct PathSearcher *ps, const char *name,
const char *syspath) {
ps->syspath = syspath ? syspath : "/bin:/usr/local/bin:/usr/bin";
if (!(ps->namelen = StrLen((ps->name = name)))) return 0;
if (ps->indirect) ps->namelen -= 4;
ps->name = name;
if (!(ps->namelen = ps->indirect ? ps->indirect : StrLen(ps->name))) return 0;
if (ps->namelen + 1 > sizeof(ps->path)) return 0;
if (FindCommand(ps)) {
return ps->path;