From fbb558df16b91d8110af5f06b651b9c7bd95ace4 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 15 Sep 2006 01:36:33 +0000
Subject: [PATCH] Bug-fix: in editfile(), don't do the whole
 copy-to-temp/edit/copy-from-temp if the filename to be edited is the same as
 the editor's temp file name.

---
 src/sbbs3/writemsg.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp
index 4e814cf135..5e27950d75 100644
--- a/src/sbbs3/writemsg.cpp
+++ b/src/sbbs3/writemsg.cpp
@@ -906,12 +906,14 @@ void sbbs_t::editfile(char *fname)
 
 	if(useron.xedit) {
 
-		msg_tmp_fname(useron.xedit, msgtmp, sizeof(msgtmp));
-		removecase(msgtmp);
-
 		SAFECOPY(path,fname);
-		if(fexistcase(path))
-			fcopy(path, msgtmp);
+
+		msg_tmp_fname(useron.xedit, msgtmp, sizeof(msgtmp));
+		if(stricmp(msgtmp,path)) {
+			removecase(msgtmp);
+			if(fexistcase(path))
+				fcopy(path, msgtmp);
+		}
 
 		editor_inf(useron.xedit,fname,nulstr,0,INVALID_SUB);
 		if(cfg.xedit[useron.xedit-1]->misc&XTRN_NATIVE)
@@ -926,7 +928,7 @@ void sbbs_t::editfile(char *fname)
 		CLS;
 		rioctl(IOCM|PAUSE|ABORT);
 		external(cmdstr(cfg.xedit[useron.xedit-1]->rcmd,msgtmp,nulstr,NULL),mode,cfg.node_dir);
-		if(!fcompare(msgtmp, path))	/* file changed */
+		if(stricmp(msgtmp,path) && !fcompare(msgtmp, path))	/* file changed */
 			fcopy(msgtmp, path);
 		rioctl(IOSM|PAUSE|ABORT); 
 		return; 
-- 
GitLab