summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2015-12-06 11:31:23 +0100
committerJeremy Allison <jra@samba.org>2015-12-08 23:01:27 +0100
commitdfceb51da87f1ebc2b75aaa714729bfbafcb1a2f (patch)
tree2b32561f9919c3f40b032c076fe5c9ab7394470a /libcli
parent190e2c013b9b478b9e8686afe1c54a81d80130e6 (diff)
downloadsamba-dfceb51da87f1ebc2b75aaa714729bfbafcb1a2f.tar.gz
libdns: Convert dns_udp_request to 0/errno
Replaces 5 calls to unix_to_werror with just one Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/dns/dns.c31
-rw-r--r--libcli/dns/libdns.h10
2 files changed, 20 insertions, 21 deletions
diff --git a/libcli/dns/dns.c b/libcli/dns/dns.c
index cc1eba988e4..cc3f90d298a 100644
--- a/libcli/dns/dns.c
+++ b/libcli/dns/dns.c
@@ -23,9 +23,8 @@
#include "system/network.h"
#include <tevent.h>
#include "lib/tsocket/tsocket.h"
-#include "libcli/util/werror.h"
#include "libcli/dns/libdns.h"
-#include "lib/util/tevent_werror.h"
+#include "lib/util/tevent_unix.h"
#include "lib/util/samba_util.h"
#include "libcli/util/error.h"
#include "librpc/gen_ndr/dns.h"
@@ -67,20 +66,20 @@ struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
ret = tsocket_address_inet_from_strings(state, "ip", NULL, 0,
&local_addr);
if (ret != 0) {
- tevent_req_werror(req, unix_to_werror(errno));
+ tevent_req_error(req, errno);
return tevent_req_post(req, ev);
}
ret = tsocket_address_inet_from_strings(state, "ip", server_addr_string,
DNS_SERVICE_PORT, &server_addr);
if (ret != 0) {
- tevent_req_werror(req, unix_to_werror(errno));
+ tevent_req_error(req, errno);
return tevent_req_post(req, ev);
}
ret = tdgram_inet_udp_socket(local_addr, server_addr, state, &dgram);
if (ret != 0) {
- tevent_req_werror(req, unix_to_werror(errno));
+ tevent_req_error(req, errno);
return tevent_req_post(req, ev);
}
@@ -118,12 +117,12 @@ static void dns_udp_request_get_reply(struct tevent_req *subreq)
TALLOC_FREE(subreq);
if (len == -1 && err != 0) {
- tevent_req_werror(req, unix_to_werror(err));
+ tevent_req_error(req, err);
return;
}
if (len != state->query_len) {
- tevent_req_werror(req, WERR_NET_WRITE_FAULT);
+ tevent_req_error(req, EIO);
return;
}
@@ -150,7 +149,7 @@ static void dns_udp_request_done(struct tevent_req *subreq)
TALLOC_FREE(subreq);
if (len == -1 && err != 0) {
- tevent_req_werror(req, unix_to_werror(err));
+ tevent_req_error(req, err);
return;
}
@@ -159,23 +158,23 @@ static void dns_udp_request_done(struct tevent_req *subreq)
tevent_req_done(req);
}
-WERROR dns_udp_request_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **reply,
- size_t *reply_len)
+int dns_udp_request_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **reply,
+ size_t *reply_len)
{
struct dns_udp_request_state *state = tevent_req_data(req,
struct dns_udp_request_state);
- WERROR w_error;
+ int err;
- if (tevent_req_is_werror(req, &w_error)) {
+ if (tevent_req_is_unix_error(req, &err)) {
tevent_req_received(req);
- return w_error;
+ return err;
}
*reply = talloc_move(mem_ctx, &state->reply);
*reply_len = state->reply_len;
tevent_req_received(req);
- return WERR_OK;
+ return 0;
}
diff --git a/libcli/dns/libdns.h b/libcli/dns/libdns.h
index 31474ebc530..7ea2eb65716 100644
--- a/libcli/dns/libdns.h
+++ b/libcli/dns/libdns.h
@@ -43,11 +43,11 @@ struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
*@param mem_ctx talloc memory context to use for the reply string
*@param reply buffer that will be allocated and filled with the dns reply
*@param reply_len length of the reply buffer
- *@return WERROR code depending on the async request result
+ *@return 0/errno
*/
-WERROR dns_udp_request_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **reply,
- size_t *reply_len);
+int dns_udp_request_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **reply,
+ size_t *reply_len);
#endif /*__LIBDNS_H__*/