| *** ../bash-5.0-patched/bashhist.c 2018-07-05 22:41:14.000000000 -0400 |
| --- bashhist.c 2019-02-23 17:12:02.000000000 -0500 |
| *************** |
| *** 437,445 **** |
| char *filename; |
| { |
| ! int fd, result; |
| struct stat buf; |
| |
| result = EXECUTION_SUCCESS; |
| ! if (history_lines_this_session > 0 && (history_lines_this_session <= where_history ())) |
| { |
| /* If the filename was supplied, then create it if necessary. */ |
| --- 437,445 ---- |
| char *filename; |
| { |
| ! int fd, result, histlen; |
| struct stat buf; |
| |
| result = EXECUTION_SUCCESS; |
| ! if (history_lines_this_session > 0) |
| { |
| /* If the filename was supplied, then create it if necessary. */ |
| *************** |
| *** 454,457 **** |
| --- 454,461 ---- |
| close (fd); |
| } |
| + /* cap the number of lines we write at the length of the history list */ |
| + histlen = where_history (); |
| + if (histlen > 0 && history_lines_this_session > histlen) |
| + history_lines_this_session = histlen; /* reset below anyway */ |
| result = append_history (history_lines_this_session, filename); |
| /* Pretend we already read these lines from the file because we just |