summaryrefslogtreecommitdiff
path: root/source4/ntvfs/sysdep/sys_notify.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-04-04 16:58:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:00:15 -0500
commit770edafbf2e284b246fb29e936a19476eacde87f (patch)
treee8b03ce2dc082f1d80aceb7a102dfc69eabb4b35 /source4/ntvfs/sysdep/sys_notify.c
parent192240634ec0751b4f1b6913b6cfab11b6f3efbe (diff)
downloadsamba-770edafbf2e284b246fb29e936a19476eacde87f.tar.gz
samba-770edafbf2e284b246fb29e936a19476eacde87f.tar.bz2
samba-770edafbf2e284b246fb29e936a19476eacde87f.zip
r14912: don't crash if inotify isn't present...
metze (This used to be commit 953aa7887b310117a05a59291f3770a9beb5e1eb)
Diffstat (limited to 'source4/ntvfs/sysdep/sys_notify.c')
-rw-r--r--source4/ntvfs/sysdep/sys_notify.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c
index aedfd2a7de..fd29f42a0e 100644
--- a/source4/ntvfs/sysdep/sys_notify.c
+++ b/source4/ntvfs/sysdep/sys_notify.c
@@ -44,10 +44,6 @@ struct sys_notify_context *sys_notify_init(int snum,
const char *bname;
struct sys_notify_backend *b;
- if (backends == NULL) {
- return NULL;
- }
-
if (ev == NULL) {
ev = event_context_find(mem_ctx);
}
@@ -60,16 +56,25 @@ struct sys_notify_context *sys_notify_init(int snum,
ctx->ev = ev;
bname = lp_parm_string(snum, "notify", "backend");
- if (bname == NULL) {
- bname = backends->name;
+ if (!bname) {
+ if (backends) {
+ bname = backends->name;
+ } else {
+ bname = "__unknown__";
+ }
}
for (b=backends;b;b=b->next) {
- if (strcasecmp(b->name, bname) == 0) break;
+ if (strcasecmp(b->name, bname) == 0) {
+ bname = b->name;
+ break;
+ }
}
+ ctx->name = bname;
+ ctx->notify_watch = NULL;
+
if (b != NULL) {
- ctx->name = b->name;
ctx->notify_watch = b->notify_watch;
}
@@ -83,6 +88,9 @@ NTSTATUS sys_notify_watch(struct sys_notify_context *ctx, const char *dirpath,
uint32_t filter, sys_notify_callback_t callback,
void *private, void **handle)
{
+ if (!ctx->notify_watch) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
return ctx->notify_watch(ctx, dirpath, filter, callback, private, handle);
}