From 586a95948029ce0491f05dfba67c986085adbb55 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 17 May 2015 20:23:35 +0200 Subject: [PATCH] ctdbd_conn: Use read_data() This is a much smaller dependency than read_data_ntstatus Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- source3/lib/ctdbd_conn.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 1285e4b3c54..f5044e1173e 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -343,7 +343,7 @@ static NTSTATUS ctdb_read_packet(int fd, TALLOC_CTX *mem_ctx, struct ctdb_req_header *req; int ret, revents; uint32_t msglen; - NTSTATUS status; + ssize_t nread; if (timeout == 0) { timeout = -1; @@ -362,9 +362,12 @@ static NTSTATUS ctdb_read_packet(int fd, TALLOC_CTX *mem_ctx, } } - status = read_data_ntstatus(fd, (char *)&msglen, sizeof(msglen)); - if (!NT_STATUS_IS_OK(status)) { - return status; + nread = read_data(fd, &msglen, sizeof(msglen)); + if (nread == -1) { + return map_nt_error_from_unix(errno); + } + if (nread == 0) { + return NT_STATUS_UNEXPECTED_IO_ERROR; } if (msglen < sizeof(struct ctdb_req_header)) { @@ -379,10 +382,13 @@ static NTSTATUS ctdb_read_packet(int fd, TALLOC_CTX *mem_ctx, req->length = msglen; - status = read_data_ntstatus(fd, ((char *)req) + sizeof(msglen), - msglen - sizeof(msglen)); - if (!NT_STATUS_IS_OK(status)) { - return status; + nread = read_data(fd, ((char *)req) + sizeof(msglen), + msglen - sizeof(msglen)); + if (nread == -1) { + return map_nt_error_from_unix(errno); + } + if (nread == 0) { + return NT_STATUS_UNEXPECTED_IO_ERROR; } *result = req; -- 2.11.4.GIT