1 |
=== modified file 'source/smbd/notify_inotify.c' |
2 |
--- source3/smbd/notify_inotify.c 2007-03-09 12:07:58 +0000 |
3 |
+++ source3/smbd/notify_inotify.c 2007-04-10 16:27:47 +0000 |
4 |
@@ -66,6 +66,7 @@ |
5 |
struct sys_notify_context *ctx; |
6 |
int fd; |
7 |
struct inotify_watch_context *watches; |
8 |
+ bool broken_inotify; /* Late stop for broken system */ |
9 |
}; |
10 |
|
11 |
struct inotify_watch_context { |
12 |
@@ -229,8 +230,16 @@ |
13 |
filenames, and thus can't know how much to allocate |
14 |
otherwise |
15 |
*/ |
16 |
- if (ioctl(in->fd, FIONREAD, &bufsize) != 0 || |
17 |
- bufsize == 0) { |
18 |
+ |
19 |
+ if ((ioctl(in->fd, FIONREAD, &bufsize) != 0) && (errno == EACCES)) { |
20 |
+ /* |
21 |
+ * Workaround for broken system (SELinux policy bug fixed since long but it is always better not to loop on EACCES) |
22 |
+ */ |
23 |
+ TALLOC_FREE(fde); |
24 |
+ in->broken_inotify = True; |
25 |
+ return; |
26 |
+ } |
27 |
+ if (bufsize == 0) { |
28 |
DEBUG(0,("No data on inotify fd?!\n")); |
29 |
return; |
30 |
} |
31 |
@@ -281,6 +290,7 @@ |
32 |
} |
33 |
in->ctx = ctx; |
34 |
in->watches = NULL; |
35 |
+ in->broken_inotify = False; |
36 |
|
37 |
ctx->private_data = in; |
38 |
talloc_set_destructor(in, inotify_destructor); |
39 |
@@ -375,6 +385,10 @@ |
40 |
|
41 |
in = talloc_get_type(ctx->private_data, struct inotify_private); |
42 |
|
43 |
+ if (in->broken_inotify) { |
44 |
+ return NT_STATUS_OK; |
45 |
+ } |
46 |
+ |
47 |
mask = inotify_map(e); |
48 |
if (mask == 0) { |
49 |
/* this filter can't be handled by inotify */ |
50 |
|