1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

ctdbd_conn: Use read_data()

This is a much smaller dependency than read_data_ntstatus

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Volker Lendecke 2015-05-17 20:23:35 +02:00
parent d821456b84
commit 586a959480

View File

@ -343,7 +343,7 @@ static NTSTATUS ctdb_read_packet(int fd, TALLOC_CTX *mem_ctx,
struct ctdb_req_header *req; struct ctdb_req_header *req;
int ret, revents; int ret, revents;
uint32_t msglen; uint32_t msglen;
NTSTATUS status; ssize_t nread;
if (timeout == 0) { if (timeout == 0) {
timeout = -1; 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)); nread = read_data(fd, &msglen, sizeof(msglen));
if (!NT_STATUS_IS_OK(status)) { if (nread == -1) {
return status; return map_nt_error_from_unix(errno);
}
if (nread == 0) {
return NT_STATUS_UNEXPECTED_IO_ERROR;
} }
if (msglen < sizeof(struct ctdb_req_header)) { 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; req->length = msglen;
status = read_data_ntstatus(fd, ((char *)req) + sizeof(msglen), nread = read_data(fd, ((char *)req) + sizeof(msglen),
msglen - sizeof(msglen)); msglen - sizeof(msglen));
if (!NT_STATUS_IS_OK(status)) { if (nread == -1) {
return status; return map_nt_error_from_unix(errno);
}
if (nread == 0) {
return NT_STATUS_UNEXPECTED_IO_ERROR;
} }
*result = req; *result = req;