From 347ca8f757d6a0b61bb22be21ffffec95986ad94 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 18 Oct 2010 10:09:57 +0200 Subject: s3: Add any_nt_status_not_ok This helps avoid quite a bit of repetitive code when looking at dcerpc_xx_recv results. --- source3/include/proto.h | 1 + source3/lib/util.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index 3e4655eeb5..6ce27b8200 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1204,6 +1204,7 @@ const char *strip_hostname(const char *s); bool tevent_req_poll_ntstatus(struct tevent_req *req, struct tevent_context *ev, NTSTATUS *status); +bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result); /* The following definitions come from lib/util_file.c */ diff --git a/source3/lib/util.c b/source3/lib/util.c index 36b2e422e2..4baeda4d0a 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2965,3 +2965,16 @@ bool tevent_req_poll_ntstatus(struct tevent_req *req, } return ret; } + +bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result) +{ + if (!NT_STATUS_IS_OK(err1)) { + *result = err1; + return true; + } + if (!NT_STATUS_IS_OK(err2)) { + *result = err2; + return true; + } + return false; +} -- cgit