From 47d61ca8db78e5976400dbe08f426c0985e6e801 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 7 Nov 2009 12:59:17 -0500 Subject: Fix tevent_req error checking. When possible using a macro that correctly deals with tstate --- server/util/util.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'server/util') diff --git a/server/util/util.h b/server/util/util.h index f13217e6..661bcebb 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -140,6 +140,18 @@ errno_t set_debug_file_from_fd(const int fd); } while(0) #endif +#define TEVENT_REQ_RETURN_ON_ERROR(req) do { \ + enum tevent_req_state TRROEstate; \ + uint64_t TRROEerr; \ + \ + if (tevent_req_is_error(req, &TRROEstate, &TRROEerr)) { \ + if (TRROEstate == TEVENT_REQ_USER_ERROR) { \ + return TRROEerr; \ + } \ + return EIO; \ + } \ +} while (0) + #include "util/dlinklist.h" /* From debug.c */ -- cgit