LP1461978: Fix Segfault in History Library user/jboyer/lp1461978_history_segfault
authorJason Boyer <JBoyer@equinoxinitiative.org>
Mon, 11 Jan 2021 14:59:39 +0000 (09:59 -0500)
committerJason Boyer <JBoyer@equinoxinitiative.org>
Mon, 11 Jan 2021 14:59:39 +0000 (09:59 -0500)
It appears an attempt was made to limit history entries to 5000
by setting history_size to 5000. There are 2 issues with this:
first, history_size is something that is retieved, not something
that is set; and secondly, to correctly set history_max_size we
need to call stifle_history(5000).

Signed-off-by: Jason Boyer <JBoyer@equinoxinitiative.org>
src/srfsh/srfsh.c

index 1887bac..079021f 100644 (file)
@@ -310,7 +310,7 @@ static int load_history( void ) {
        history_file = strdup(fbuf);
 
        if(!access(history_file, W_OK | R_OK )) {
-               history_length = 5000;
+               stifle_history(5000);
                read_history(history_file);
        }
        return 1;