Skip to content
Snippets Groups Projects
Commit 48f73ca1 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't log errno info for ERR_CHK errormsg() calls

The errno (global error number) information is not relevant for any sbbs "checking" type errors.
Also, use safe_strerror() for thread-safe errno descriptions.
parent c3427ac6
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
/* Synchronet log file routines */
/* $Id: logfile.cpp,v 1.69 2020/08/08 19:32:30 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -15,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -239,21 +225,28 @@ void sbbs_t::errormsg(int line, const char* function, const char *src, const cha
,long access, const char *extinfo)
{
char str[2048];
char errno_str[128];
char errno_info[256] = "";
/* prevent recursion */
if(errormsg_inside)
return;
errormsg_inside=true;
safe_snprintf(str,sizeof(str),"ERROR %d (%s) "
#ifdef _WIN32
"(WinError %u) "
#endif
if(strcmp(action, ERR_CHK) != 0)
safe_snprintf(errno_info, sizeof(errno_info), "%d (%s) "
#ifdef _WIN32
"(WinError %u) "
#endif
,errno, safe_strerror(errno, errno_str, sizeof(errno_str))
#ifdef _WIN32
,GetLastError()
#endif
);
safe_snprintf(str,sizeof(str),"ERROR %s"
"in %s line %u (%s) %s \"%s\" access=%ld %s%s"
,errno,STRERROR(errno)
#ifdef _WIN32
,GetLastError()
#endif
,errno_info
,src, line, function, action, object, access
,extinfo==NULL ? "":"info="
,extinfo==NULL ? "":extinfo);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment