changeset 20853:ec2d92883d82

lib-program-client: Fixed potential panic in test-program-client-local If the run finished before io_loop_run(), it would panic with: Panic: BUG: No IOs or timeouts set. Not waiting for infinity.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 10 Oct 2016 21:22:15 +0300
parents 1c4be30c9e9b
children e706c8ff0922
files src/lib-program-client/test-program-client-local.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-program-client/test-program-client-local.c	Mon Oct 10 21:19:34 2016 +0300
+++ b/src/lib-program-client/test-program-client-local.c	Mon Oct 10 21:22:15 2016 +0300
@@ -94,7 +94,7 @@
 void test_program_io_async(void) {
 	test_begin("test_program_io (async)");
 
-	int ret;
+	int ret = -2;
 	struct ioloop *ioloop = io_loop_create();
 	io_loop_set_current(ioloop);
 
@@ -114,7 +114,8 @@
 
 	program_client_run_async(pc, test_program_io_async_callback, &ret);
 
-	io_loop_run(ioloop);
+	if (ret == -2)
+		io_loop_run(ioloop);
 
 	test_assert(strcmp(str_c(output), pclient_test_io_string) == 0);