From 34da61b3516b0f4700f5293865804a1f174244c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 20 Mar 2015 13:14:19 +0100 Subject: [PATCH] test: fix tty_file, close handle if initialized If the handle is closed when it wasn't initialized, uv_close will fail. PR-URL: https://github.com/libuv/libuv/pull/279 Reviewed-By: Ben Noordhuis --- test/test-tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-tty.c b/test/test-tty.c index c4203334..7d0249a9 100644 --- a/test/test-tty.c +++ b/test/test-tty.c @@ -167,9 +167,9 @@ TEST_IMPL(tty_file) { if (fd != -1) { ASSERT(0 == uv_tty_init(&loop, &tty, fd, 1)); ASSERT(0 == close(fd)); + uv_close((uv_handle_t*) &tty, NULL); } - uv_close((uv_handle_t*) &tty, NULL); ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT)); ASSERT(0 == uv_loop_close(&loop));