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