Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
repair for PATH-based location of current executable
Repair provided by @sxzzsf.

Closes #4627

(cherry picked from commit cf2a13b)
  • Loading branch information
mflatt authored and jbclements committed Apr 15, 2023
1 parent c8d4c6a commit 2f1535a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions racket/src/start/self_exe.inc
Expand Up @@ -315,7 +315,7 @@ static char *lookup_exe_via_path(const char *exec_file) XFORM_SKIP_PROC
return r;
} else {
/* We have to find the executable by searching PATH: */
char *path = copy_string(getenv("PATH")), *p, *m;
char *path = copy_string(getenv("PATH")), *p, *m, *saved_path = path;
int more;

if (!path) {
Expand All @@ -342,7 +342,7 @@ static char *lookup_exe_via_path(const char *exec_file) XFORM_SKIP_PROC
m = path_append(get_current_directory(), m);
free(old_m);
}
free(path);
if (saved_path) free(saved_path);
return m;
}
free(m);
Expand All @@ -353,7 +353,7 @@ static char *lookup_exe_via_path(const char *exec_file) XFORM_SKIP_PROC
break;
}

free(path);
if (saved_path) free(saved_path);

return copy_string(exec_file);
}
Expand Down

0 comments on commit 2f1535a

Please sign in to comment.