mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-24 13:53:07 +01:00
Fix
This commit is contained in:
parent
5b6e333366
commit
72e5ef62c8
19
src/ctpv.c
19
src/ctpv.c
@ -122,6 +122,25 @@ static int check_file(char **f, char *f_link)
|
||||
}
|
||||
} else {
|
||||
f_link[f_link_len] = '\0';
|
||||
|
||||
/* If link is not an absolute path, get absolute path */
|
||||
if (f_link[0] != '/') {
|
||||
char f_link_tmp[FILENAME_MAX];
|
||||
strncpy(f_link_tmp, f_link, f_link_len);
|
||||
|
||||
ERRCHK_RET_ERN(getcwd(f_link, FILENAME_MAX) == NULL);
|
||||
|
||||
f_link_len = strlen(f_link);
|
||||
|
||||
if (f_link[f_link_len-1] != '/') {
|
||||
f_link[f_link_len] = '/';
|
||||
f_link[f_link_len+1] = '\0';
|
||||
f_link_len++;
|
||||
}
|
||||
|
||||
strcpy(f_link + f_link_len, f_link_tmp);
|
||||
}
|
||||
|
||||
if (access(f_link, R_OK) == 0)
|
||||
*f = f_link;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user