[PATCH] dbwrap_file: fix use of read_data
Jeremy Allison
jra at samba.org
Tue Jan 26 19:51:34 UTC 2016
On Tue, Jan 26, 2016 at 09:35:57PM +0200, Uri Simchoni wrote:
> Hi,
>
> Something I found while checking the possibility of renaming read_data.
Good catch !
> Apparently no part of samba uses dbwrap_file so a different "fix"
> might be to remove it.
I'll push your fix for now, and we can debate removing it
later.
Thanks !
> 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