Skip to content

Commit

Permalink
more bug fix to absolute/relative path inference
Browse files Browse the repository at this point in the history
  • Loading branch information
Wanding Zhou committed Sep 6, 2020
1 parent 33139c1 commit 3f445dc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions view.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,15 @@ int main_view(int argc, char *argv[]) {

/* get real path */
char buf[PATH_MAX];
char *tmp = strdup(tbks[i].fname);
strcpy(buf, dirname(tmp));
free(tmp);
strcat(buf, "/");
strcat(buf, tbks[i].extra);
if (tbks[i].extra[0] == '/') {
strcpy(buf, tbks[i].extra);
} else {
char *tmp = strdup(tbks[i].fname);
strcpy(buf, dirname(tmp));
free(tmp);
strcat(buf, "/");
strcat(buf, tbks[i].extra);
}
char *res = realpath(buf, NULL);
if (res) {
DIR *d = opendir(res);
Expand Down

0 comments on commit 3f445dc

Please sign in to comment.