aboutsummaryrefslogtreecommitdiffstats
path: root/autoreload.c
diff options
context:
space:
mode:
Diffstat (limited to 'autoreload.c')
-rw-r--r--autoreload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/autoreload.c b/autoreload.c
index 8b3f6da..8325210 100644
--- a/autoreload.c
+++ b/autoreload.c
@@ -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));
}