diff --git a/ChangeLog b/ChangeLog
index c8ec5c5f79c35af12b1864a1baddfbed1b7273c6..defa469e12424affc0b278f13812930ce61b5be7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ CVS code -
   write_file()
 	- Added O_EXCL to open call if tmp is set, more security which hopefully
 	  fixes any remaining security issues.
+	- Added tmp check to TMP_OPT section (how apropriate).
 
 nano 0.9.22 - 12/02/2000
 - General
diff --git a/files.c b/files.c
index 029217cc8df60318ff1981542f3bf6da51998a99..eb874ab0bbdec9df7a8f3d86d923fc39d9d685b1 100644
--- a/files.c
+++ b/files.c
@@ -346,7 +346,7 @@ int write_file(char *name, int tmp)
 		       S_IWOTH);
 	/* Open the file and truncate it.  Trust the symlink. */
 	if (fd == -1) {
-	    if (ISSET(TEMP_OPT)) {
+	    if (!tmp && ISSET(TEMP_OPT)) {
 		UNSET(TEMP_OPT);
 		return do_writeout(1);
 	    }