c37dcab40813a4ac550ca27ca15d09657f111f2e
[busybox-power] / debian / patches / 0002-hush-don-t-save-history-when-non-interactive.patch
1 From 03b2e51fbe2d69823cea54e6b3ecb7db7d981879 Mon Sep 17 00:00:00 2001
2 From: Dennis Groenen <tj.groenen@gmail.com>
3 Date: Sun, 21 Aug 2011 13:31:41 +0200
4 Subject: [PATCH] hush: don't save history when non-interactive
5
6 ---
7  shell/hush.c |    7 +++++++
8  1 files changed, 7 insertions(+), 0 deletions(-)
9
10 diff --git a/shell/hush.c b/shell/hush.c
11 index a7428d6..4ea641b 100644
12 --- a/shell/hush.c
13 +++ b/shell/hush.c
14 @@ -7832,6 +7832,7 @@ int hush_main(int argc, char **argv)
15                                 //set_local_var(xasprintf("HISTFILE=%s", ...));
16                         }
17                 }
18 +               G.line_input_state->flags &= ~SAVE_HISTORY; /* hush is non-interactive at this point */
19  # if ENABLE_FEATURE_SH_HISTFILESIZE
20                 hp = get_local_var_value("HISTFILESIZE");
21                 G.line_input_state->max_history = size_from_HISTFILESIZE(hp);
22 @@ -8053,6 +8054,12 @@ int hush_main(int argc, char **argv)
23          *    standard output is a terminal
24          * Refer to Posix.2, the description of the 'sh' utility.
25          */
26 +#if ENABLE_FEATURE_EDITING
27 +# if defined MAX_HISTORY && MAX_HISTORY > 0 && ENABLE_HUSH_SAVEHISTORY
28 +       G.line_input_state->flags |= SAVE_HISTORY;
29 +# endif
30 +#endif
31 +
32  #if ENABLE_HUSH_JOB
33         if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
34                 G_saved_tty_pgrp = tcgetpgrp(STDIN_FILENO);
35 -- 
36 1.7.6
37