diff options
author | Volker Lendecke <vl@samba.org> | 2014-12-04 16:01:17 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-12-09 06:37:24 +0100 |
commit | 9bb0728f7c71cf72e31ac15c74912479a803f323 (patch) | |
tree | 9a9e3d84f86c25071be15494d404eb4dfc5501a9 | |
parent | 658ffb19826b3cfde323c3e16fde4f713e88ffd8 (diff) | |
download | samba-9bb0728f7c71cf72e31ac15c74912479a803f323.tar.gz samba-9bb0728f7c71cf72e31ac15c74912479a803f323.tar.xz samba-9bb0728f7c71cf72e31ac15c74912479a803f323.zip |
notify_inotify: Simplify inotify_dispatch
Normally, I'm trying to simplify things with early returns. But in
this case I think the reverse makes the if-condition easier to
understand
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 9 06:37:24 CET 2014 on sn-devel-104
-rw-r--r-- | source3/smbd/notify_inotify.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index 944f27a155..8f4712404f 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -168,23 +168,25 @@ static void inotify_dispatch(struct inotify_private *in, } } - /* SMB expects a file rename to generate three events, two for - the rename and the other for a modify of the - destination. Strange! */ - if (ne.action != NOTIFY_ACTION_NEW_NAME || - (e->mask & IN_ISDIR) != 0) { - return; - } + if ((ne.action == NOTIFY_ACTION_NEW_NAME) && + ((e->mask & IN_ISDIR) == 0)) { - ne.action = NOTIFY_ACTION_MODIFIED; - e->mask = IN_ATTRIB; + /* + * SMB expects a file rename to generate three events, two for + * the rename and the other for a modify of the + * destination. Strange! + */ - for (w=in->watches;w;w=next) { - next = w->next; - if (w->wd == e->wd && filter_match(w, e) && - !(w->filter & FILE_NOTIFY_CHANGE_CREATION)) { - ne.dir = w->path; - w->callback(in->ctx, w->private_data, &ne); + ne.action = NOTIFY_ACTION_MODIFIED; + e->mask = IN_ATTRIB; + + for (w=in->watches;w;w=next) { + next = w->next; + if (w->wd == e->wd && filter_match(w, e) && + !(w->filter & FILE_NOTIFY_CHANGE_CREATION)) { + ne.dir = w->path; + w->callback(in->ctx, w->private_data, &ne); + } } } } |