diff --git a/libc/calls/getprogramexecutablename.greg.c b/libc/calls/getprogramexecutablename.greg.c index 17d270ad4..5d3c576b5 100644 --- a/libc/calls/getprogramexecutablename.greg.c +++ b/libc/calls/getprogramexecutablename.greg.c @@ -98,6 +98,7 @@ static int TryPath(const char *q, int com) { } *p = 0; if (!sys_faccessat(AT_FDCWD, g_prog.u.buf, F_OK, 0)) return 1; + if (!com) return 0; p = WRITE32LE(p, READ32LE(".com")); *p = 0; if (!sys_faccessat(AT_FDCWD, g_prog.u.buf, F_OK, 0)) return 1;