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;
if (fde == NULL) {
ctx->private_data = NULL;
TALLOC_FREE(in);
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
-
- return NT_STATUS_OK;
+ return 0;
}
/* 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);