mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Fix #537
This commit is contained in:
parent
6689870460
commit
33fdbc2216
|
@ -1040,7 +1040,12 @@ static char *abspath(const char *path, const char *cwd)
|
||||||
size_t dst_size = 0, src_size = xstrlen(path), cwd_size = xstrlen(cwd);
|
size_t dst_size = 0, src_size = xstrlen(path), cwd_size = xstrlen(cwd);
|
||||||
const char *src;
|
const char *src;
|
||||||
char *dst;
|
char *dst;
|
||||||
char *resolved_path = malloc(src_size + (*path == '/' ? 0 : cwd_size) + 1);
|
/*
|
||||||
|
* We need to add 2 chars at the end as relative paths may start with:
|
||||||
|
* ./ (find .)
|
||||||
|
* no separator (fd .): this needs an additional char for '/'
|
||||||
|
*/
|
||||||
|
char *resolved_path = malloc(src_size + (*path == '/' ? 0 : cwd_size) + 2);
|
||||||
if (!resolved_path)
|
if (!resolved_path)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue