unix: uClibc doesn't like NULL as a buffer arg to realpath().
So, allocate one explicitly.
This commit is contained in:
parent
a96cc824bd
commit
69d0a1c540
@ -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])));
|
||||
|
Loading…
Reference in New Issue
Block a user