Use the same pointer from FileWatch to refer to the entry in a parent FileWatch

This commit is contained in:
2025-05-02 00:17:31 +03:00
parent 5539596929
commit fc9cdb5885

View File

@@ -140,7 +140,7 @@ HiResult file_watch_add(FileWatcherContext *ctx, u32 mask,
int wd = inotify_add_watch(ctx->fd, parent_name, params.parent_mask);
FileWatch wp = {.wd = wd, .mask = HI_FILE_PARENT, .path = parent_name};
sc_array_init(&wp.files);
sc_array_add(&wp.files, strdup(watch->path));
sc_array_add(&wp.files, watch->path);
sc_array_add(&ctx->watches, wp);
} else {
free(parent_name);