From 8b4363c25e2adf5f8c48b1ea93e30c523cdcd4d5 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Fri, 13 Nov 2020 00:24:22 -0800
Subject: [PATCH] Add timestamp of node.log file to crash.log

When a preexisting node.log file is found, a terminal server crash is suspected. Include the timestamp of the node.log in the message appended to the system log (data/logs/*.log) to help identify the likely time of the crash.
---
 src/sbbs3/main.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 0aee306206..e52f7727fb 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -3490,6 +3490,7 @@ bool sbbs_t::init()
 {
 	char		str[MAX_PATH+1];
 	char		tmp[128];
+	char		tmp2[128];
 	int			result;
 	uint		i,j,k,l;
 	node_t		node;
@@ -3592,11 +3593,13 @@ bool sbbs_t::init()
 			now=time(NULL);
 			struct tm tm;
 			localtime_r(&now,&tm);
+			time_t ftime = fdate(str);
 			safe_snprintf(str,sizeof(str),"%s  %s %s %02d %u  "
-				"End of preexisting log entry (possible crash)"
+				"End of preexisting log entry (possible crash on %.24s)"
 				,hhmmtostr(&cfg,&tm,tmp)
 				,wday[tm.tm_wday]
-				,mon[tm.tm_mon],tm.tm_mday,tm.tm_year+1900);
+				,mon[tm.tm_mon],tm.tm_mday,tm.tm_year+1900
+				,ctime_r(&ftime, tmp2));
 			logline(LOG_NOTICE,"L!",str);
 			log(crlf);
 			catsyslog(TRUE);
-- 
GitLab