[PATCH] tevent_req_recv_simple_unix
Volker Lendecke
Volker.Lendecke at SerNet.DE
Sat Nov 8 04:57:34 MST 2014
Hi!
Attached find a patchset that implements something similar
to tevent_req_simple_recv_ntstatus for unix 0/errno returns.
I'd appreciate review&push.
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 8b01598ed50acda3406c4e92a54e10fa38ee618b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 8 Nov 2014 09:00:31 +0000
Subject: [PATCH 1/2] lib: Add tevent_req_simple_recv_unix
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/util/tevent_unix.c | 13 +++++++++++++
lib/util/tevent_unix.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/lib/util/tevent_unix.c b/lib/util/tevent_unix.c
index e4c960e..ee7ec8a 100644
--- a/lib/util/tevent_unix.c
+++ b/lib/util/tevent_unix.c
@@ -48,3 +48,16 @@ bool tevent_req_is_unix_error(struct tevent_req *req, int *perrno)
}
return true;
}
+
+int tevent_req_simple_recv_unix(struct tevent_req *req)
+{
+ int err = 0;
+
+ /*
+ * Ignore result of tevent_req_is_unix_error, we're only interested in
+ * the status
+ */
+ tevent_req_is_unix_error(req, &err);
+ tevent_req_received(req);
+ return err;
+}
diff --git a/lib/util/tevent_unix.h b/lib/util/tevent_unix.h
index 377e976..c1b0eb4 100644
--- a/lib/util/tevent_unix.h
+++ b/lib/util/tevent_unix.h
@@ -27,5 +27,6 @@
#include <tevent.h>
bool tevent_req_is_unix_error(struct tevent_req *req, int *perrno);
+int tevent_req_simple_recv_unix(struct tevent_req *req);
#endif
--
1.9.1
From 1f12c900e7907eeded3a6c4192db76f73e1c2e3c Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 8 Nov 2014 09:05:23 +0000
Subject: [PATCH 2/2] Use tevent_req_simple_recv_unix in a few places
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/lib/ctdb_conn.c | 6 +-----
source3/lib/tevent_barrier.c | 7 +------
source3/lib/tevent_wait.c | 7 +------
source3/smbd/notify_internal.c | 7 +------
4 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/source3/lib/ctdb_conn.c b/source3/lib/ctdb_conn.c
index c705c21..a54e83d 100644
--- a/source3/lib/ctdb_conn.c
+++ b/source3/lib/ctdb_conn.c
@@ -347,11 +347,7 @@ static void ctdb_conn_msg_write_done(struct tevent_req *subreq)
int ctdb_conn_msg_write_recv(struct tevent_req *req)
{
- int err;
- if (tevent_req_is_unix_error(req, &err)) {
- return err;
- }
- return 0;
+ return tevent_req_simple_recv_unix(req);
}
struct ctdb_msg_channel {
diff --git a/source3/lib/tevent_barrier.c b/source3/lib/tevent_barrier.c
index d699b5f..318c896 100644
--- a/source3/lib/tevent_barrier.c
+++ b/source3/lib/tevent_barrier.c
@@ -188,10 +188,5 @@ static void tevent_barrier_release_trigger(struct tevent_context *ctx,
int tevent_barrier_wait_recv(struct tevent_req *req)
{
- int err;
-
- if (tevent_req_is_unix_error(req, &err)) {
- return err;
- }
- return 0;
+ return tevent_req_simple_recv_unix(req);
}
diff --git a/source3/lib/tevent_wait.c b/source3/lib/tevent_wait.c
index ec7c8cb..81fb213 100644
--- a/source3/lib/tevent_wait.c
+++ b/source3/lib/tevent_wait.c
@@ -74,10 +74,5 @@ static void tevent_wait_trigger(struct tevent_context *ctx,
int tevent_wait_recv(struct tevent_req *req)
{
- int err;
-
- if (tevent_req_is_unix_error(req, &err)) {
- return err;
- }
- return 0;
+ return tevent_req_simple_recv_unix(req);
}
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index 4e9862a..9d54891 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -1251,10 +1251,5 @@ static void notify_cluster_proxy_trigger(struct notify_context *notify,
int notify_cluster_proxy_recv(struct tevent_req *req)
{
- int err;
-
- if (tevent_req_is_unix_error(req, &err)) {
- return err;
- }
- return 0;
+ return tevent_req_simple_recv_unix(req);
}
--
1.9.1
More information about the samba-technical
mailing list