smbd: Use read_data() in notify_inotify
authorVolker Lendecke <vl@samba.org>
Wed, 19 Nov 2014 14:41:42 +0000 (14:41 +0000)
committerJeremy Allison <jra@samba.org>
Sun, 7 Dec 2014 01:37:04 +0000 (02:37 +0100)
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): Sun Dec  7 02:37:04 CET 2014 on sn-devel-104

source3/smbd/notify_inotify.c

index a9b7131ef75607e3acc9916c0d0fe1ca2b84788e..5fbc7f22eede7ceaa896d8c1b63e0c497266e814 100644 (file)
@@ -24,6 +24,7 @@
 #include "includes.h"
 #include "../librpc/gen_ndr/notify.h"
 #include "smbd/smbd.h"
+#include "lib/sys_rw_data.h"
 
 #ifdef HAVE_INOTIFY
 
@@ -201,7 +202,7 @@ static void inotify_handler(struct tevent_context *ev, struct tevent_fd *fde,
        struct inotify_event *e0, *e;
        uint32_t prev_cookie=0;
        int prev_wd = -1;
-       NTSTATUS status;
+       ssize_t ret;
 
        /*
          we must use FIONREAD as we cannot predict the length of the
@@ -219,10 +220,10 @@ static void inotify_handler(struct tevent_context *ev, struct tevent_fd *fde,
        if (e == NULL) return;
        ((uint8_t *)e)[bufsize] = '\0';
 
-       status = read_data_ntstatus(in->fd, (char *)e0, bufsize);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0,("Failed to read all inotify data - %s\n",
-                       nt_errstr(status)));
+       ret = read_data(in->fd, e0, bufsize);
+       if (ret != bufsize) {
+               DEBUG(0, ("Failed to read all inotify data - %s\n",
+                         strerror(errno)));
                talloc_free(e0);
                /* the inotify fd will now be out of sync,
                 * can't keep reading data off it */