troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
633 stars 64 forks source link

Fix AUTO_RELOAD #define typo #337

Closed JackNewman12 closed 1 year ago

JackNewman12 commented 1 year ago

It looks like the makefiles are creating a AUTO_RELOAD define, but the code is looking for ENABLE_AUTO_RELOAD. Making this change fixes the auto-reload feature for me.

I also noticed that conf.c do_change() seems to ignore deleted files. Commenting out this checks causes a deleted or moved .conf to correctly remove a service. Not sure why this check is here so I'm afraid I might be missing some edge-cases.

 static int do_change(char *dir, char *name, uint32_t mask) 
 { 
    char fn[strlen(dir) + strlen(name) + 2]; 
    struct conf_change *node; 

    paste(fn, sizeof(fn), dir, name); 
    dbg("path: %s mask: %08x", fn, mask); 

    node = conf_find(fn); 
-   if (mask & (IN_DELETE | IN_MOVED_FROM)) { 
-       drop_change(node); 
-       return 0; 
-   }
    if (node) {
        dbg("Event already registered for %s ...", name);
        return 0;
    }
troglobit commented 1 year ago

Ah thanks, a too hasty refactor by me. Great fix!

About the second part, looks weird and doesn't have a comment to why so I'm inclined to drop it. But I'll get to you on that, creating a separate issue for it.