mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
inotifyd: save resourses by closing unused inotify descriptors
This commit is contained in:
parent
d16950ded9
commit
d723fb155d
@ -53,9 +53,6 @@ enum {
|
|||||||
MASK_BITS = sizeof(mask_names) - 1
|
MASK_BITS = sizeof(mask_names) - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int inotify_init(void);
|
|
||||||
extern int inotify_add_watch(int fd, const char *path, uint32_t mask);
|
|
||||||
|
|
||||||
int inotifyd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int inotifyd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int inotifyd_main(int argc, char **argv)
|
int inotifyd_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -160,9 +157,11 @@ int inotifyd_main(int argc, char **argv)
|
|||||||
args[3] = ie->len ? ie->name : NULL;
|
args[3] = ie->len ? ie->name : NULL;
|
||||||
wait4pid(xspawn((char **)args));
|
wait4pid(xspawn((char **)args));
|
||||||
// we are done if all files got final x event
|
// we are done if all files got final x event
|
||||||
if (ie->mask & 0x8000)
|
if (ie->mask & 0x8000) {
|
||||||
if (--argc <= 0)
|
if (--argc <= 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
inotify_rm_watch(pfd.fd, ie->wd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// next event
|
// next event
|
||||||
i = sizeof(struct inotify_event) + ie->len;
|
i = sizeof(struct inotify_event) + ie->len;
|
||||||
|
Loading…
Reference in New Issue
Block a user