if (!ent)
oom();
ent->len = len;
- memcpy(ent->name, name, len+1);
+ memcpy(ent->name, name, len);
+ ent->name[len] = 0;
cmdname[cmdname_cnt++] = ent;
}
continue;
entlen = strlen(de->d_name);
+ if (4 < entlen && !strcmp(de->d_name + entlen - 4, ".exe"))
+ entlen -= 4;
if (longest < entlen)
longest = entlen;
while (!strncmp(exec_path, "./", 2)) {
exec_path += 2;
while (*exec_path == '/')
- *exec_path++;
+ exec_path++;
}
snprintf(git_command + len, sizeof(git_command) - len,
"/%s", exec_path);