summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-10-27 13:09:44 +0000
committerJeremy Allison <jra@samba.org>2014-12-09 04:12:08 +0100
commiteb10a36a96f5b4da4ab4677761b8dab7ceeec7b0 (patch)
tree0d8934377ac3892d09954f6841560ea8ab92f24c
parent608774d8c4a14863d1e603d0b2f0dac94e8f69a7 (diff)
downloadsamba-eb10a36a96f5b4da4ab4677761b8dab7ceeec7b0.tar.gz
samba-eb10a36a96f5b4da4ab4677761b8dab7ceeec7b0.tar.xz
samba-eb10a36a96f5b4da4ab4677761b8dab7ceeec7b0.zip
notify_inotify: Make inotify_setup return 0/errno
This gets rid of one NT_STATUS_HAVE_NO_MEMORY with its implicit return; :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/smbd/notify_inotify.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c
index 56f4941066..613b0387d7 100644
--- a/source3/smbd/notify_inotify.c
+++ b/source3/smbd/notify_inotify.c
@@ -250,18 +250,22 @@ static void inotify_handler(struct tevent_context *ev, struct tevent_fd *fde,
setup the inotify handle - called the first time a watch is added on
this context
*/
-static NTSTATUS inotify_setup(struct sys_notify_context *ctx)
+static int inotify_setup(struct sys_notify_context *ctx)
{
struct inotify_private *in;
struct tevent_fd *fde;
in = talloc(ctx, struct inotify_private);
- NT_STATUS_HAVE_NO_MEMORY(in);
+ if (in == NULL) {
+ return ENOMEM;
+ }
+
in->fd = inotify_init();
if (in->fd == -1) {
- DEBUG(0,("Failed to init inotify - %s\n", strerror(errno)));
+ int ret = errno;
+ DEBUG(0, ("Failed to init inotify - %s\n", strerror(ret)));
talloc_free(in);
- return map_nt_error_from_unix(errno);
+ return ret;
}
in->ctx = ctx;
in->watches = NULL;
@@ -275,10 +279,9 @@ static NTSTATUS inotify_setup(struct sys_notify_context *ctx)
if (fde == NULL) {
ctx->private_data = NULL;
TALLOC_FREE(in);
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
-
- return NT_STATUS_OK;
+ return 0;
}
@@ -360,9 +363,11 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
/* maybe setup the inotify fd */
if (ctx->private_data == NULL) {
- NTSTATUS status;
- status = inotify_setup(ctx);
- NT_STATUS_NOT_OK_RETURN(status);
+ int ret;
+ ret = inotify_setup(ctx);
+ if (ret != 0) {
+ return map_nt_error_from_unix(ret);
+ }
}
in = talloc_get_type(ctx->private_data, struct inotify_private);