aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-14 10:10:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-14 10:10:40 +0000
commitbf3561fd15cff3fbfe6f67d134c23149ed35f493 (patch)
tree470421827cff5e05f2f299f069ebc6e96f5d9a88 /libbb
parentf5294e1f4c56afb377ada95a7757b28ad3c89086 (diff)
downloadbusybox-bf3561fd15cff3fbfe6f67d134c23149ed35f493.tar.gz
lineedit: do not try to open NULL history file
Diffstat (limited to 'libbb')
-rw-r--r--libbb/lineedit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index edc0e513c..59baf23a8 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -953,7 +953,7 @@ static void remember_in_history(const char *str)
state->history[i++] = xstrdup(str);
state->cur_history = i;
state->cnt_history = i;
- if (state->flags & SAVE_HISTORY)
+ if ((state->flags & SAVE_HISTORY) && state->hist_file)
save_history(state->hist_file);
USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines++;)
}
@@ -1273,7 +1273,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t
/* With null flags, no other fields are ever used */
state = st ? st : (line_input_t*) &const_int_0;
#if ENABLE_FEATURE_EDITING_SAVEHISTORY
- if (state->flags & SAVE_HISTORY)
+ if ((state->flags & SAVE_HISTORY) && state->hist_file)
load_history(state->hist_file);
#endif