diff options
author | Christian Weisgerber <naddy@FreeBSD.org> | 2003-10-06 13:36:39 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@FreeBSD.org> | 2003-10-06 13:36:39 +0000 |
commit | 0a34781d2974d9df5c7fd48de1cd527fb08c4aed (patch) | |
tree | 7ef1bdcac654f19ecb83af324c0ac8481c7bb1e3 /editors/nano/files/patch-files.c | |
parent | Update runtime to latest versions. (diff) |
Fix fatal memory allocation bug.
Notes
Notes:
svn path=/head/; revision=90449
Diffstat (limited to 'editors/nano/files/patch-files.c')
-rw-r--r-- | editors/nano/files/patch-files.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/editors/nano/files/patch-files.c b/editors/nano/files/patch-files.c new file mode 100644 index 000000000000..b77ce3705488 --- /dev/null +++ b/editors/nano/files/patch-files.c @@ -0,0 +1,56 @@ + +$FreeBSD$ + +--- files.c.orig Sun Oct 5 02:30:55 2003 ++++ files.c Sun Oct 5 02:35:06 2003 +@@ -1701,16 +1701,17 @@ + #ifdef NANO_EXTRA + static int did_cred = 0; + #endif ++ static char *writepath = NULL; + + #if !defined(DISABLE_BROWSER) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)) + currshortcut = writefile_list; + #endif + +- answer = mallocstrcpy(answer, path); ++ writepath = mallocstrcpy(writepath, path); + + if (exiting && ISSET(TEMP_OPT)) { + if (filename[0] != '\0') { +- i = write_file(answer, 0, 0, 0); ++ i = write_file(writepath, 0, 0, 0); + display_main_list(); + return i; + } else { +@@ -1751,24 +1752,24 @@ + "%s%s%s", _("Write Selection to File"), formatstr, backupstr); + } else { + if (append == 2) +- i = statusq(1, writefile_list, answer, 0, ++ i = statusq(1, writefile_list, writepath, 0, + "%s%s%s", _("File Name to Prepend to"), formatstr, backupstr); + else if (append == 1) +- i = statusq(1, writefile_list, answer, 0, ++ i = statusq(1, writefile_list, writepath, 0, + "%s%s%s", _("File Name to Append to"), formatstr, backupstr); + else +- i = statusq(1, writefile_list, answer, 0, ++ i = statusq(1, writefile_list, writepath, 0, + "%s%s%s", _("File Name to Write"), formatstr, backupstr); + } + #else + if (append == 2) +- i = statusq(1, writefile_list, answer, ++ i = statusq(1, writefile_list, writepath, + "%s", _("File Name to Prepend to")); + else if (append == 1) +- i = statusq(1, writefile_list, answer, ++ i = statusq(1, writefile_list, writepath, + "%s", _("File Name to Append to")); + else +- i = statusq(1, writefile_list, answer, ++ i = statusq(1, writefile_list, writepath, + "%s", _("File Name to Write")); + #endif /* !NANO_SMALL */ + |