summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-06-19 06:12:25 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-06-19 06:12:25 -0700
commit2f2d654c20c75a7cc6e5c1c28803f475c929abba (patch)
treeabedca54286718724c91a639245924fe918a53c3
parentf063fb64a24be163903ec0560eaba9af05cab25c (diff)
downloadtxr-2f2d654c20c75a7cc6e5c1c28803f475c929abba.tar.gz
txr-2f2d654c20c75a7cc6e5c1c28803f475c929abba.tar.bz2
txr-2f2d654c20c75a7cc6e5c1c28803f475c929abba.zip
listener: perms complaint for missing .txr_history
* parser.c (repl): The listener wrongly complains that .txr_history has bad permissions when it doesn't exist. New users of TXR won't have a history file, so this looks sloppy. Since we load the history file regardless of the check, let's do the check in the case when the file has successfully loaded.
-rw-r--r--parser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index 8b0d1dd4..7698ac24 100644
--- a/parser.c
+++ b/parser.c
@@ -1475,9 +1475,11 @@ val repl(val bindings, val in_stream, val out_stream, val env)
lino_hist_set_max_len(ls, c_num(cdr(hist_len_var)));
if (histfile_w) {
- if (!funcall1(path_private_to_me_p, histfile))
+ if (lino_hist_load(ls, histfile_w) == 0 &&
+ !funcall1(path_private_to_me_p, histfile))
+ {
report_security_problem(histfile);
- lino_hist_load(ls, histfile_w);
+ }
}
lino_set_noninteractive(ls, opt_noninteractive);