diff options
-rw-r--r-- | gnu/lib/libreadline/histfile.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gnu/lib/libreadline/histfile.c b/gnu/lib/libreadline/histfile.c index ad200d3051b..180f20ea3e2 100644 --- a/gnu/lib/libreadline/histfile.c +++ b/gnu/lib/libreadline/histfile.c @@ -339,7 +339,7 @@ history_do_write (filename, nelements, overwrite) the_history = history_list (); /* Calculate the total number of bytes to write. */ - for (buffer_size = 0, i = history_length - nelements; i < history_length; i++) + for (buffer_size = 1, i = history_length - nelements; i < history_length; i++) buffer_size += 1 + strlen (the_history[i]->line); /* Allocate the buffer, and fill it. */ @@ -352,7 +352,7 @@ history_do_write (filename, nelements, overwrite) strlcat (buffer, "\n", buffer_size); } - write (file, buffer, buffer_size); + write (file, buffer, buffer_size - 1); free (buffer); } |