From: jca Date: Mon, 15 Jan 2018 22:30:38 +0000 (+0000) Subject: Don't try to open HISTFILE if the variable is unset. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e2f403d15ab190a455dd9d4efca30d7dfb7cc64f;p=openbsd Don't try to open HISTFILE if the variable is unset. str_val returns null, not NULL, if the variable isn't set. The erroneous check means that we later tried to open(""). ok millert@ tb@ anton@ benno@ --- diff --git a/bin/ksh/history.c b/bin/ksh/history.c index 84ea5fdf263..67735c90964 100644 --- a/bin/ksh/history.c +++ b/bin/ksh/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.79 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: history.c,v 1.80 2018/01/15 22:30:38 jca Exp $ */ /* * command history @@ -791,10 +791,9 @@ hist_init(Source *s) hist_source = s; - hname = str_val(global("HISTFILE")); - if (hname == NULL) + if (str_val(global("HISTFILE")) == null) return; - hname = str_save(hname, APERM); + hname = str_save(str_val(global("HISTFILE")), APERM); histfh = history_open(); if (histfh == NULL) return;