Commit 69d0a1c5 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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

So, allocate one explicitly.
parent 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% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment