Jeremie Courreges-Anglas(j...@wxcvbn.org) on 2018.01.15 21:45:56 +0100:
> 
> This quirk has been there since rev 1.1: if HISTFILE isn't set, str_val
> should return null, not NULL.  Since the check against NULL fails we try
> to open("", ...), which of course fails.
> 
> ok?

ok

> Index: history.c
> ===================================================================
> RCS file: /d/cvs/src/bin/ksh/history.c,v
> retrieving revision 1.79
> diff -u -p -p -u -r1.79 history.c
> --- history.c 15 Jan 2018 14:58:05 -0000      1.79
> +++ history.c 15 Jan 2018 20:41:54 -0000
> @@ -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;
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

Reply via email to