mirror of
https://codeberg.org/nsxiv/nsxiv
synced 2024-11-15 12:13:10 +00:00
fix: autoreload when directory is root (#498)
for cases like "/file", `base - filepath` will result in 0
instead of 1.
regression introduced in: 94d531fd82
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/498
Reviewed-by: eylles <eylles@noreply.codeberg.org>
This commit is contained in:
parent
420a0a2455
commit
faf67fcc62
@ -86,7 +86,7 @@ void arl_add(arl_t *arl, const char *filepath)
|
||||
|
||||
base = strrchr(filepath, '/');
|
||||
assert(base != NULL); /* filepath must be result of `realpath(3)` */
|
||||
dir = arl_scratch_push(filepath, base - filepath);
|
||||
dir = arl_scratch_push(filepath, MAX(base - filepath, 1));
|
||||
add_watch(arl->fd, &arl->wd_dir, dir, IN_CREATE | IN_MOVED_TO);
|
||||
arl->filename = arl_scratch_push(base + 1, strlen(base + 1));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user