The "fd" variable is defined at larger scope to be the result of open(/dev/inotify). Overriding it at local scope, and sending the ioctl's to the wrong place, is not such a good idea :) Todor Penev also came up with an identical fix, but was not quite so vocal about it. --- gamin-0.0.26.orig/server/gam_inotify.c 2005-03-28 20:25:10.000000000 +0200 +++ gamin-0.0.26/server/gam_inotify.c 2005-04-03 01:16:14.000000000 +0200 @@ -118,17 +117,17 @@ gam_inotify_add_rm_handler(const char *p } { - int fd = open(path, O_RDONLY); + int file_fd = open(path, O_RDONLY); - if (fd < 0) { + if (file_fd < 0) { G_UNLOCK(inotify); return; } - iwr.fd = fd; + iwr.fd = file_fd; iwr.mask = 0xffffffff; // all events wd = ioctl(fd, INOTIFY_WATCH, &iwr); - close (fd); + close (file_fd); } if (wd < 0) {