krb5 commit: Improve EINTR handling in bttest

Tom Yu tlyu at mit.edu
Tue Aug 16 21:46:13 EDT 2016


https://github.com/krb5/krb5/commit/dbf6e70d04c094b6cf0ef076a62ef4ca27001183
commit dbf6e70d04c094b6cf0ef076a62ef4ca27001183
Author: Tom Yu <tlyu at mit.edu>
Date:   Mon Aug 8 09:12:16 2016 -0400

    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 files changed, 7 insertions(+), 1 deletions(-)

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 0d78d59..2aee3a3 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;


More information about the cvs-krb5 mailing list