]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-program-client: Fixed potential panic in test-program-client-local
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Oct 2016 18:22:15 +0000 (21:22 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 13 Oct 2016 08:27:41 +0000 (10:27 +0200)
If the run finished before io_loop_run(), it would panic with:
Panic: BUG: No IOs or timeouts set. Not waiting for infinity.

src/lib-program-client/test-program-client-local.c

index a69c7c72404a888dd2746c09454c27c27dfba183..04f12fb94c5c2c3819d3ebf5a233c836b00fab86 100644 (file)
@@ -94,7 +94,7 @@ static
 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 @@ void test_program_io_async(void) {
 
        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);