diff options
Diffstat (limited to 'miscutils/bc.c')
-rw-r--r-- | miscutils/bc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 15089314f..148e340a5 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -7121,7 +7121,23 @@ static BcStatus bc_vm_run(int argc, char *argv[], | |||
7121 | 7121 | ||
7122 | if (G.ttyin) { | 7122 | if (G.ttyin) { |
7123 | #if ENABLE_FEATURE_BC_SIGNALS | 7123 | #if ENABLE_FEATURE_BC_SIGNALS |
7124 | signal_no_SA_RESTART_empty_mask(SIGINT, record_signo); | 7124 | // With SA_RESTART, most system calls will restart |
7125 | // (IOW: they won't fail with EINTR). | ||
7126 | // In particular, this means ^C won't cause | ||
7127 | // stdout to get into "error state" if SIGINT hits | ||
7128 | // within write() syscall. | ||
7129 | // The downside is that ^C while line input is taken | ||
7130 | // will only be handled after [Enter] since read() | ||
7131 | // from stdin is not interrupted by ^C either, | ||
7132 | // it restarts, thus fgetc() does not return on ^C. | ||
7133 | signal_SA_RESTART_empty_mask(SIGINT, record_signo); | ||
7134 | |||
7135 | // Without SA_RESTART, this exhibits a bug: | ||
7136 | // "while (1) print 1" and try ^C-ing it. | ||
7137 | // Intermittently, instead of returning to input line, | ||
7138 | // you'll get "output error: Interrupted system call" | ||
7139 | // and exit. | ||
7140 | //signal_no_SA_RESTART_empty_mask(SIGINT, record_signo); | ||
7125 | #endif | 7141 | #endif |
7126 | if (!(option_mask32 & BC_FLAG_Q)) | 7142 | if (!(option_mask32 & BC_FLAG_Q)) |
7127 | bc_vm_info(); | 7143 | bc_vm_info(); |