mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
parent
d938b89f4f
commit
db6152e21d
1 changed files with 2 additions and 2 deletions
|
@ -78,10 +78,9 @@ static textstartup void GetProgramExecutableName(char executable[SIZE],
|
||||||
char *p) {
|
char *p) {
|
||||||
char *t;
|
char *t;
|
||||||
size_t m;
|
size_t m;
|
||||||
ssize_t n;
|
|
||||||
int cmd[4];
|
int cmd[4];
|
||||||
|
ssize_t n = 0;
|
||||||
if (IsWindows() && GetNtExePath(executable)) return;
|
if (IsWindows() && GetNtExePath(executable)) return;
|
||||||
n = 0;
|
|
||||||
if (fileexists(p)) {
|
if (fileexists(p)) {
|
||||||
if (!_isabspath(p)) {
|
if (!_isabspath(p)) {
|
||||||
if (getcwd(executable, SIZE - 1)) {
|
if (getcwd(executable, SIZE - 1)) {
|
||||||
|
@ -111,6 +110,7 @@ static textstartup void GetProgramExecutableName(char executable[SIZE],
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (n < 0) n = 0;
|
||||||
for (; *p; ++p) {
|
for (; *p; ++p) {
|
||||||
if (n + 1 < SIZE) {
|
if (n + 1 < SIZE) {
|
||||||
executable[n++] = *p;
|
executable[n++] = *p;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue