]>
Commit | Line | Data |
---|---|---|
1d13e637 AF |
1 | Index: samba-3.6.6/source3/smbd/notify_inotify.c |
2 | =================================================================== | |
3 | --- samba-3.6.6.orig/source3/smbd/notify_inotify.c | |
4 | +++ samba-3.6.6/source3/smbd/notify_inotify.c | |
5 | @@ -77,6 +77,7 @@ struct inotify_private { | |
6 | struct sys_notify_context *ctx; | |
7 | int fd; | |
8 | struct inotify_watch_context *watches; | |
9 | + bool broken_inotify; /* Late stop for broken system */ | |
10 | }; | |
11 | ||
12 | struct inotify_watch_context { | |
13 | @@ -241,8 +242,15 @@ static void inotify_handler(struct event | |
14 | filenames, and thus can't know how much to allocate | |
15 | otherwise | |
16 | */ | |
17 | - if (ioctl(in->fd, FIONREAD, &bufsize) != 0 || | |
18 | - bufsize == 0) { | |
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 | TALLOC_FREE(fde); | |
30 | return; | |
31 | @@ -300,6 +308,7 @@ static NTSTATUS inotify_setup(struct sys | |
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 | @@ -394,6 +403,10 @@ NTSTATUS inotify_watch(struct sys_notify | |
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 */ |