diff options
Diffstat (limited to 'source3/lib/unix_msg')
-rw-r--r-- | source3/lib/unix_msg/test_drain.c | 11 | ||||
-rw-r--r-- | source3/lib/unix_msg/test_source.c | 16 | ||||
-rw-r--r-- | source3/lib/unix_msg/tests.c | 23 |
3 files changed, 38 insertions, 12 deletions
diff --git a/source3/lib/unix_msg/test_drain.c b/source3/lib/unix_msg/test_drain.c index 6fe8c188367..c2568b6646b 100644 --- a/source3/lib/unix_msg/test_drain.c +++ b/source3/lib/unix_msg/test_drain.c @@ -16,7 +16,7 @@ static void recv_cb(struct unix_msg_ctx *ctx, int main(int argc, const char *argv[]) { - struct poll_funcs funcs; + struct poll_funcs *funcs; const char *sock; struct unix_msg_ctx *ctx; struct tevent_context *ev; @@ -37,10 +37,13 @@ int main(int argc, const char *argv[]) perror("tevent_context_init failed"); return 1; } - poll_funcs_init_tevent(&funcs, ev); + funcs = poll_funcs_init_tevent(ev); + if (funcs == NULL) { + fprintf(stderr, "poll_funcs_init_tevent failed\n"); + return 1; + } - ret = unix_msg_init(sock, &funcs, 256, 1, - recv_cb, &state, &ctx); + ret = unix_msg_init(sock, funcs, 256, 1, recv_cb, &state, &ctx); if (ret != 0) { fprintf(stderr, "unix_msg_init failed: %s\n", strerror(ret)); diff --git a/source3/lib/unix_msg/test_source.c b/source3/lib/unix_msg/test_source.c index bfafee1fd33..94984d88523 100644 --- a/source3/lib/unix_msg/test_source.c +++ b/source3/lib/unix_msg/test_source.c @@ -5,7 +5,8 @@ int main(int argc, const char *argv[]) { - struct poll_funcs funcs; + struct poll_funcs *funcs; + void *tevent_handle; struct unix_msg_ctx **ctxs; struct tevent_context *ev; struct iovec iov; @@ -26,7 +27,16 @@ int main(int argc, const char *argv[]) perror("tevent_context_init failed"); return 1; } - poll_funcs_init_tevent(&funcs, ev); + funcs = poll_funcs_init_tevent(NULL); + if (funcs == NULL) { + fprintf(stderr, "poll_funcs_init_tevent failed\n"); + return 1; + } + tevent_handle = poll_funcs_tevent_register(NULL, funcs, ev); + if (tevent_handle == NULL) { + fprintf(stderr, "poll_funcs_tevent_register failed\n"); + return 1; + } ctxs = talloc_array(ev, struct unix_msg_ctx *, num_ctxs); if (ctxs == NULL) { @@ -35,7 +45,7 @@ int main(int argc, const char *argv[]) } for (i=0; i<num_ctxs; i++) { - ret = unix_msg_init(NULL, &funcs, 256, 1, NULL, NULL, + ret = unix_msg_init(NULL, funcs, 256, 1, NULL, NULL, &ctxs[i]); if (ret != 0) { fprintf(stderr, "unix_msg_init failed: %s\n", diff --git a/source3/lib/unix_msg/tests.c b/source3/lib/unix_msg/tests.c index 2a4cf862347..29d5dcb3745 100644 --- a/source3/lib/unix_msg/tests.c +++ b/source3/lib/unix_msg/tests.c @@ -32,7 +32,8 @@ static void expect_messages(struct tevent_context *ev, struct cb_state *state, int main(void) { - struct poll_funcs funcs; + struct poll_funcs *funcs; + void *tevent_handle; const char *sock1 = "sock1"; const char *sock2 = "sock2"; struct unix_msg_ctx *ctx1, *ctx2; @@ -52,9 +53,19 @@ int main(void) perror("tevent_context_init failed"); return 1; } - poll_funcs_init_tevent(&funcs, ev); - ret = unix_msg_init(sock1, &funcs, 256, 1, + funcs = poll_funcs_init_tevent(ev); + if (funcs == NULL) { + fprintf(stderr, "poll_funcs_init_tevent failed\n"); + return 1; + } + tevent_handle = poll_funcs_tevent_register(ev, funcs, ev); + if (tevent_handle == NULL) { + fprintf(stderr, "poll_funcs_register_tevent failed\n"); + return 1; + } + + ret = unix_msg_init(sock1, funcs, 256, 1, recv_cb, &state, &ctx1); if (ret != 0) { fprintf(stderr, "unix_msg_init failed: %s\n", @@ -62,7 +73,7 @@ int main(void) return 1; } - ret = unix_msg_init(sock1, &funcs, 256, 1, + ret = unix_msg_init(sock1, funcs, 256, 1, recv_cb, &state, &ctx1); if (ret == 0) { fprintf(stderr, "unix_msg_init succeeded unexpectedly\n"); @@ -74,7 +85,7 @@ int main(void) return 1; } - ret = unix_msg_init(sock2, &funcs, 256, 1, + ret = unix_msg_init(sock2, funcs, 256, 1, recv_cb, &state, &ctx2); if (ret != 0) { fprintf(stderr, "unix_msg_init failed: %s\n", @@ -201,6 +212,8 @@ int main(void) unix_msg_free(ctx1); unix_msg_free(ctx2); + talloc_free(tevent_handle); + talloc_free(funcs); talloc_free(ev); return 0; |