提交 69d0a1c5 编写于 作者: P Paul Sokolovsky

unix: uClibc doesn't like NULL as a buffer arg to realpath().

So, allocate one explicitly.
上级 a96cc824
......@@ -365,7 +365,8 @@ int main(int argc, char **argv) {
return usage(argv);
}
} else {
char *basedir = realpath(argv[a], NULL);
char *pathbuf = malloc(PATH_MAX);
char *basedir = realpath(argv[a], pathbuf);
if (basedir == NULL) {
fprintf(stderr, "%s: can't open file '%s': [Errno %d] ", argv[0], argv[a], errno);
perror("");
......@@ -377,7 +378,7 @@ int main(int argc, char **argv) {
// Set base dir of the script as first entry in sys.path
char *p = strrchr(basedir, '/');
path_items[0] = MP_OBJ_NEW_QSTR(qstr_from_strn(basedir, p - basedir));
free(basedir);
free(pathbuf);
for (int i = a; i < argc; i++) {
mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册