mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-21 18:27:22 +00:00
sh(1): fix history file write checking
We cannot just compare histsizeval() against 0, since that returns a string pointer, which is always non-zero (non-null). The logic in sethistsize() initializes the history size to 100 with values that are non-number, and an empty string counts as that. Therefore, the only time we want to not write into history with HISTSIZE val set is when it's explicitly 0. MFC after: 2 weeks
This commit is contained in:
parent
a6719858a4
commit
3ce64010f8
|
@ -90,7 +90,7 @@ get_histfile(void)
|
|||
const char *histfile;
|
||||
|
||||
/* don't try to save if the history size is 0 */
|
||||
if (hist == NULL || histsizeval() == 0)
|
||||
if (hist == NULL || !strcmp(histsizeval(), "0"))
|
||||
return (NULL);
|
||||
histfile = expandstr("${HISTFILE-${HOME-}/.sh_history}");
|
||||
|
||||
|
|
Loading…
Reference in a new issue