Index: nano/src/files.c =================================================================== RCS file: /cvsroot/nano/nano/src/files.c,v retrieving revision 1.84 diff -u -r1.84 files.c --- nano/src/files.c 15 Oct 2004 16:25:56 -0000 1.84 +++ nano/src/files.c 22 Oct 2004 00:59:00 -0000 @@ -1602,7 +1602,9 @@ /* First, just give up if we couldn't even open the file. */ if (fd == -1) { statusbar(_("Error writing %s: %s"), realname, strerror(errno)); - unlink(tempname); + /* tempname has been set only if we're prepending. */ + if (tempname != NULL) + unlink(tempname); goto cleanup_and_exit; }