2009-12-17 17:47:57 +00:00
|
|
|
--- source3/smbd/notify_inotify.c.inotify 2009-12-15 09:25:26.000000000 +0100
|
|
|
|
+++ source3/smbd/notify_inotify.c 2009-12-17 18:42:06.000000000 +0100
|
|
|
|
@@ -75,6 +75,7 @@
|
2007-04-16 14:40:03 +00:00
|
|
|
struct sys_notify_context *ctx;
|
|
|
|
int fd;
|
|
|
|
struct inotify_watch_context *watches;
|
2008-11-27 21:19:30 +00:00
|
|
|
+ bool broken_inotify; /* Late stop for broken system */
|
2007-04-16 14:40:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct inotify_watch_context {
|
2009-12-17 17:47:57 +00:00
|
|
|
@@ -239,8 +240,15 @@
|
2007-04-16 14:40:03 +00:00
|
|
|
filenames, and thus can't know how much to allocate
|
|
|
|
otherwise
|
|
|
|
*/
|
|
|
|
- if (ioctl(in->fd, FIONREAD, &bufsize) != 0 ||
|
|
|
|
- bufsize == 0) {
|
|
|
|
+ if ((ioctl(in->fd, FIONREAD, &bufsize) != 0) && (errno == EACCES)) {
|
|
|
|
+ /*
|
2008-11-27 21:19:30 +00:00
|
|
|
+ * Workaround for broken system (SELinux policy bug fixed since long but it is always better not to loop on EACCES)
|
2007-04-16 14:40:03 +00:00
|
|
|
+ */
|
|
|
|
+ TALLOC_FREE(fde);
|
|
|
|
+ in->broken_inotify = True;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (bufsize == 0) {
|
|
|
|
DEBUG(0,("No data on inotify fd?!\n"));
|
2009-12-17 17:47:57 +00:00
|
|
|
TALLOC_FREE(fde);
|
2007-04-16 14:40:03 +00:00
|
|
|
return;
|
2009-12-17 17:47:57 +00:00
|
|
|
@@ -297,6 +305,7 @@
|
2007-04-16 14:40:03 +00:00
|
|
|
}
|
|
|
|
in->ctx = ctx;
|
|
|
|
in->watches = NULL;
|
|
|
|
+ in->broken_inotify = False;
|
|
|
|
|
|
|
|
ctx->private_data = in;
|
|
|
|
talloc_set_destructor(in, inotify_destructor);
|
2009-12-17 17:47:57 +00:00
|
|
|
@@ -391,6 +400,10 @@
|
2007-04-16 14:40:03 +00:00
|
|
|
|
|
|
|
in = talloc_get_type(ctx->private_data, struct inotify_private);
|
|
|
|
|
|
|
|
+ if (in->broken_inotify) {
|
|
|
|
+ return NT_STATUS_OK;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
mask = inotify_map(e);
|
|
|
|
if (mask == 0) {
|
|
|
|
/* this filter can't be handled by inotify */
|