From: Volker Lendecke Date: Thu, 24 May 2012 11:49:26 +0000 (+0200) Subject: lib: add tevent_req_poll_werror X-Git-Tag: samba-4.0.0beta1~162 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54cde76e376b7e6a781ff2841234d7f37eb6ea93;p=thirdparty%2Fsamba.git lib: add tevent_req_poll_werror Signed-off-by: Kai Blin --- diff --git a/lib/util/tevent_werror.c b/lib/util/tevent_werror.c index d8956b398f1..47bd809cbc0 100644 --- a/lib/util/tevent_werror.c +++ b/lib/util/tevent_werror.c @@ -19,6 +19,7 @@ #include "../replace/replace.h" #include "tevent_werror.h" +#include "libcli/util/error.h" bool _tevent_req_werror(struct tevent_req *req, WERROR werror, @@ -79,3 +80,15 @@ void tevent_req_simple_finish_werror(struct tevent_req *subreq, } tevent_req_done(req); } + +bool tevent_req_poll_werror(struct tevent_req *req, + struct tevent_context *ev, + WERROR *err) +{ + bool ret = tevent_req_poll(req, ev); + if (!ret) { + NTSTATUS status = map_nt_error_from_unix_common(errno); + *err = ntstatus_to_werror(status); + } + return ret; +} diff --git a/lib/util/tevent_werror.h b/lib/util/tevent_werror.h index 0e243825b6c..1e08c3dc52b 100644 --- a/lib/util/tevent_werror.h +++ b/lib/util/tevent_werror.h @@ -40,4 +40,7 @@ WERROR tevent_req_simple_recv_werror(struct tevent_req *req); void tevent_req_simple_finish_werror(struct tevent_req *subreq, WERROR subreq_error); +bool tevent_req_poll_werror(struct tevent_req *req, + struct tevent_context *ev, + WERROR *err); #endif