]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Improve EINTR handling in bttest
authorTom Yu <tlyu@mit.edu>
Mon, 8 Aug 2016 13:12:16 +0000 (09:12 -0400)
committerTom Yu <tlyu@mit.edu>
Tue, 16 Aug 2016 19:23:39 +0000 (15:23 -0400)
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

index 0d78d593436ff94b8875942e1b993251112b70dd..2aee3a32c05eff6137f9dd5b5e69f507f0cc630b 100644 (file)
@@ -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;