Allocating enough space for printing out the line and column numbers.
This fixes Savannah bug #47135. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5639 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
813f9f72d0
commit
ec3cd1eeae
|
@ -2,6 +2,8 @@
|
|||
* src/browser.c (do_browser, browser_refresh): Rebuild the file list
|
||||
only when necessary, not for each and every cursor movement. This
|
||||
fixes Savannah bug #47133.
|
||||
* src/files.c (save_poshistory): Allocate enough space for printing
|
||||
out the line and column numbers. This fixes Savannah bug #47135.
|
||||
|
||||
GNU nano 2.5.2 - 2016.02.12
|
||||
|
||||
|
|
|
@ -3177,7 +3177,9 @@ void save_poshistory(void)
|
|||
chmod(poshist, S_IRUSR | S_IWUSR);
|
||||
|
||||
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
|
||||
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
|
||||
/* Assume 20 decimal positions each for line and column number,
|
||||
* plus two spaces, plus the line feed, plus the null byte. */
|
||||
statusstr = charalloc(strlen(posptr->filename) + 44);
|
||||
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
|
||||
(long)posptr->xno);
|
||||
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))
|
||||
|
|
Loading…
Reference in New Issue