Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame^] | 1 | From e174b6e7d195d5a7465575641b7f68581f162574 Mon Sep 17 00:00:00 2001 |
| 2 | From: Li Zhou <li.zhou@windriver.com> |
| 3 | Date: Thu, 27 Jun 2019 13:10:47 +0800 |
| 4 | Subject: [PATCH] dc: fix exit code of q command |
| 5 | |
| 6 | The exit code for "echo q | dc" is 1 for dc-1.4.1; |
| 7 | while the exit code for "echo q | dc" is 0 for dc-1.4. |
| 8 | |
| 9 | Here is the answer from ken@gnu.org: |
| 10 | dc-1.4 was right. There was a rewrite of a chunk of code for 1.4.1 to |
| 11 | fix a corner case in the Q command, and somehow the placement of the |
| 12 | clean-up label for the 'q' command got misplaced on the error-handling |
| 13 | branch instead of the clean-exit branch. The patch below fixes this |
| 14 | (it is committed for whenever the next bc/dc release gets made). |
| 15 | |
| 16 | Thanks for the report, |
| 17 | --Ken Pizzini |
| 18 | |
| 19 | Upstream-Status: Backport [Got the solution from maintainer] |
| 20 | |
| 21 | Signed-off-by: Li Zhou <li.zhou@windriver.com> |
| 22 | --- |
| 23 | dc/eval.c | 2 +- |
| 24 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 25 | |
| 26 | diff --git a/dc/eval.c b/dc/eval.c |
| 27 | index 05a3d9e..bcab8db 100644 |
| 28 | --- a/dc/eval.c |
| 29 | +++ b/dc/eval.c |
| 30 | @@ -814,10 +814,10 @@ error_fail: |
| 31 | fprintf(stderr, "%s: ", progname); |
| 32 | perror("error reading input"); |
| 33 | return DC_FAIL; |
| 34 | -reset_and_exit_quit: |
| 35 | reset_and_exit_fail: |
| 36 | signal(SIGINT, sigint_default); |
| 37 | return DC_FAIL; |
| 38 | +reset_and_exit_quit: |
| 39 | reset_and_exit_success: |
| 40 | signal(SIGINT, sigint_default); |
| 41 | return DC_SUCCESS; |
| 42 | -- |
| 43 | 1.9.1 |
| 44 | |