dbwrap_file: fix use of read_data()
authorUri Simchoni <uri@samba.org>
Thu, 21 Jan 2016 11:18:20 +0000 (13:18 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 26 Jan 2016 23:09:05 +0000 (00:09 +0100)
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 27 00:09:05 CET 2016 on sn-devel-144

lib/dbwrap/dbwrap_file.c

index a3b1737..46e62c8 100644 (file)
@@ -171,7 +171,7 @@ static struct db_record *db_file_fetch_locked(struct db_context *db,
        result->value.dptr = NULL;
 
        if (statbuf.st_ex_size != 0) {
-               NTSTATUS status;
+               ssize_t read_bytes;
 
                result->value.dsize = statbuf.st_ex_size;
                result->value.dptr = talloc_array(result, uint8_t,
@@ -182,11 +182,10 @@ static struct db_record *db_file_fetch_locked(struct db_context *db,
                        return NULL;
                }
 
-               status = read_data(file->fd, (char *)result->value.dptr,
-                                 result->value.dsize);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(3, ("read_data failed: %s\n",
-                                 nt_errstr(status)));
+               read_bytes = read_data(file->fd, (char *)result->value.dptr,
+                                      result->value.dsize);
+               if (read_bytes != result->value.dsize) {
+                       DEBUG(3, ("read_data failed: %s\n", strerror(errno)));
                        TALLOC_FREE(result);
                        return NULL;
                }