From dbf6e70d04c094b6cf0ef076a62ef4ca27001183 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Mon, 8 Aug 2016 09:12:16 -0400 Subject: [PATCH] Improve EINTR handling in bttest The libdb2 btree debugging program bttest doesn't handle EINTR in its input loop. This causes difficulties with debugging using lldb, because bttest gets signals like SIGSTOP when being attached, and lldb doesn't seem to share the terminal well with a program being debugged. ticket: 8478 (new) subject: usability improvements for bttest --- src/plugins/kdb/db2/libdb2/test/btree.tests/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/kdb/db2/libdb2/test/btree.tests/main.c b/src/plugins/kdb/db2/libdb2/test/btree.tests/main.c index 0d78d59343..2aee3a32c0 100644 --- a/src/plugins/kdb/db2/libdb2/test/btree.tests/main.c +++ b/src/plugins/kdb/db2/libdb2/test/btree.tests/main.c @@ -232,8 +232,14 @@ user(db) for (last = 0;;) { (void)printf("> "); (void)fflush(stdout); - if ((lbuf = fgets(&buf[0], 512, ifp)) == NULL) + if ((lbuf = fgets(&buf[0], 512, ifp)) == NULL) { + (void)printf("\n"); + if (ferror(ifp) && errno == EINTR) { + clearerr(ifp); + continue; + } break; + } if (lbuf[0] == '\n') { i = last; goto uselast; -- 2.47.2