[PATCH] dbwrap_file: fix use of read_data
Uri Simchoni
uri at samba.org
Tue Jan 26 19:35:57 UTC 2016
Hi,
Something I found while checking the possibility of renaming read_data.
Apparently no part of samba uses dbwrap_file so a different "fix" might
be to remove it.
Thanks,
Uri.
-------------- next part --------------
From ff7b3fc14ad5e8985aa2a5eb50e26de840ca5045 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Thu, 21 Jan 2016 13:18:20 +0200
Subject: [PATCH] dbwrap_file: fix use of read_data()
Signed-off-by: Uri Simchoni <uri at samba.org>
---
lib/dbwrap/dbwrap_file.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/dbwrap/dbwrap_file.c b/lib/dbwrap/dbwrap_file.c
index a3b1737..46e62c8 100644
--- a/lib/dbwrap/dbwrap_file.c
+++ b/lib/dbwrap/dbwrap_file.c
@@ -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;
}
--
2.4.3
More information about the samba-technical
mailing list