lib: add tevent_req_poll_werror
authorVolker Lendecke <vl@samba.org>
Thu, 24 May 2012 11:49:26 +0000 (13:49 +0200)
committerKai Blin <kai@samba.org>
Tue, 29 May 2012 22:37:56 +0000 (00:37 +0200)
Signed-off-by: Kai Blin <kai@samba.org>
lib/util/tevent_werror.c
lib/util/tevent_werror.h

index d8956b398f1e18aa1135d3fcdc16cf14232eaa8d..47bd809cbc060855655f52a80f11202573712581 100644 (file)
@@ -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;
+}
index 0e243825b6c36760434ee90e060c7ab62838e79f..1e08c3dc52be6e04dd2a22e78d1aa5ec4aa4d211 100644 (file)
@@ -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