Always resolve to canonical path

This commit is contained in:
topjohnwu 2021-05-10 01:14:53 -07:00
parent a5cc31783c
commit 6099f3b015

View File

@ -192,9 +192,11 @@ void install_module(const char *file) {
if (access(file, F_OK)) if (access(file, F_OK))
abort(stderr, "'%s' does not exist", file); abort(stderr, "'%s' does not exist", file);
char *zip = realpath(file, nullptr);
setenv("OUTFD", "1", 1); setenv("OUTFD", "1", 1);
setenv("ZIPFILE", file, 1); setenv("ZIPFILE", zip, 1);
setenv("ASH_STANDALONE", "1", 1); setenv("ASH_STANDALONE", "1", 1);
free(zip);
int fd = xopen("/dev/null", O_RDONLY); int fd = xopen("/dev/null", O_RDONLY);
xdup2(fd, STDERR_FILENO); xdup2(fd, STDERR_FILENO);