+2009-12-20 Brian Szymanski <skibrianski via Savannah>
+ * src/files.c (write_file): Check stat struct exists, and if not use just obtained stat data.
+ Fixes Ubuntu bug 471568, "reproducible crash in nano on trying to save to a file
+ different than the one specified on the command line".
+
2009-12-15 Chris Allegretta <chrisa@asty.org>
* doc/nanorc.sample.in - Remove erroneous 'set suspendenable' as it's actually a
key binding (e.g. 'bind M-Z suspendenable all') and not a settable flag. Fixes
* one). */
realexists = (stat(realname, &st) != -1);
+ /* if we have not stat()d this file before (say, the user just
+ * specified it interactively), use the info we just got from
+ * stat()ing or else we will chase null pointers when we do
+ * modtime checks, preserve file times, etc. during backup */
+ if(openfile->current_stat == NULL)
+ openfile->current_stat = &st;
+
#ifndef NANO_TINY
/* We backup only if the backup toggle is set, the file isn't
* temporary, and the file already exists. Furthermore, if we