aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
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