diff options
author | Denis Vlasenko | 2008-11-29 09:07:24 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-11-29 09:07:24 +0000 |
commit | d723fb155d3db4152a4781dff550cd0f0ce290b5 (patch) | |
tree | 69f903e904b664a1f6cc79208a7ad2b77b47f657 /miscutils | |
parent | d16950ded91446a23a6ceef35fb3e100400301d9 (diff) | |
download | busybox-d723fb155d3db4152a4781dff550cd0f0ce290b5.zip busybox-d723fb155d3db4152a4781dff550cd0f0ce290b5.tar.gz |
inotifyd: save resourses by closing unused inotify descriptors
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/inotifyd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c index fdf2a2c..d6b5d24 100644 --- a/miscutils/inotifyd.c +++ b/miscutils/inotifyd.c @@ -53,9 +53,6 @@ enum { 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) { @@ -160,9 +157,11 @@ int inotifyd_main(int argc, char **argv) args[3] = ie->len ? ie->name : NULL; wait4pid(xspawn((char **)args)); // we are done if all files got final x event - if (ie->mask & 0x8000) + if (ie->mask & 0x8000) { if (--argc <= 0) goto done; + inotify_rm_watch(pfd.fd, ie->wd); + } } // next event i = sizeof(struct inotify_event) + ie->len; |