aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-02-13 10:01:35 +0000
committerRon Yorston <rmy@pobox.com>2023-02-13 10:01:35 +0000
commit4e5fb4341fddc2b99e815f27ac577d85a57994c2 (patch)
treec9e2eae6d2752d7e7f907ad39e3797b0fd5c3e02 /libbb
parent0f2feac4b7e518e838b80d7b8ceac8f9699ae997 (diff)
parent93ae7464e6e460f25b73e4ffefd2d9a6499eae30 (diff)
downloadbusybox-w32-4e5fb4341fddc2b99e815f27ac577d85a57994c2.tar.gz
busybox-w32-4e5fb4341fddc2b99e815f27ac577d85a57994c2.tar.bz2
busybox-w32-4e5fb4341fddc2b99e815f27ac577d85a57994c2.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb')
-rw-r--r--libbb/lineedit.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index bee423553..c4f0c65f1 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2300,7 +2300,8 @@ static int lineedit_read_key(char *read_key_buffer, int timeout)
2300 * "\xff\n",pause,"ls\n" invalid and thus won't lose "ls". 2300 * "\xff\n",pause,"ls\n" invalid and thus won't lose "ls".
2301 * 2301 *
2302 * If LI_INTERRUPTIBLE, return -1 if got EINTR in poll() 2302 * If LI_INTERRUPTIBLE, return -1 if got EINTR in poll()
2303 * inside read_key, or if bb_got_signal != 0 (IOW: if signal 2303 * inside read_key and bb_got_signal became != 0,
2304 * or if bb_got_signal != 0 (IOW: if signal
2304 * arrived before poll() is reached). 2305 * arrived before poll() is reached).
2305 * 2306 *
2306 * Note: read_key sets errno to 0 on success. 2307 * Note: read_key sets errno to 0 on success.
@@ -2317,14 +2318,16 @@ static int lineedit_read_key(char *read_key_buffer, int timeout)
2317 IF_FEATURE_EDITING_WINCH(S.ok_to_redraw = 0;) 2318 IF_FEATURE_EDITING_WINCH(S.ok_to_redraw = 0;)
2318 if (errno != EINTR) 2319 if (errno != EINTR)
2319 break; 2320 break;
2321 /* It was EINTR. Repeat read_key() unless... */
2320 if (state->flags & LI_INTERRUPTIBLE) { 2322 if (state->flags & LI_INTERRUPTIBLE) {
2321 /* LI_INTERRUPTIBLE bails out on EINTR, 2323 /* LI_INTERRUPTIBLE bails out on EINTR
2322 * but nothing really guarantees that bb_got_signal 2324 * if bb_got_signal became nonzero.
2323 * is nonzero. Follow the least surprise principle: 2325 * (It may stay zero: for example, our SIGWINCH
2326 * handler does not set it. This is used for signals
2327 * which should not interrupt line editing).
2324 */ 2328 */
2325 if (bb_got_signal == 0) 2329 if (bb_got_signal != 0)
2326 bb_got_signal = 255; 2330 goto ret; /* will return -1 */
2327 goto ret;
2328 } 2331 }
2329 } 2332 }
2330 2333