]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdbd_conn: Use read_data()
authorVolker Lendecke <vl@samba.org>
Sun, 17 May 2015 18:23:35 +0000 (20:23 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 28 May 2015 09:13:09 +0000 (11:13 +0200)
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>
source3/lib/ctdbd_conn.c

index 1285e4b3c54715af91a743f6f10296181d8e13b1..f5044e1173ee6461c3df63b98f6d4cf25c281527 100644 (file)
@@ -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;