Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit b4b6713e authored by rswindell's avatar rswindell

Error messages logged with errormsg() now contain the name of the C/C++

function where the error is being reported from. So the WHERE macro now
contains the __FUNCTION__ "macro" and the various js*.c files that use the
WHERE macro to report errors had to be updated too.
Also, the 'access' argument is now being passed as a signed long rather than
unsigned long. Status/return values are often passed in here (e.g. from smblib)
and may be negative. This argument was being displayed with %ld but wasn't
being passed in as a signed value, so on 64-bit long systems, negative numbers
were just printed as large (4M+) numbers.
Also, no need to call getfname() in errormsg() since this is embedded in the
WHERE macro (since 2009).
parent 2664c427
......@@ -55,7 +55,7 @@ typedef struct
} private_t;
static const char* getprivate_failure = "line %d %s JS_GetPrivate failed";
static const char* getprivate_failure = "line %d %s %s JS_GetPrivate failed";
static void dbprintf(BOOL error, private_t* p, char* fmt, ...)
{
......
......@@ -11,7 +11,7 @@ struct private_data {
CRYPT_CONTEXT ctx;
};
static const char* getprivate_failure = "line %d %s JS_GetPrivate failed";
static const char* getprivate_failure = "line %d %s %s JS_GetPrivate failed";
// Helpers
static void
......
/* js_file.c */
/* Synchronet JavaScript "File" Object */
/* $Id$ */
......@@ -67,7 +65,7 @@ typedef struct
} private_t;
static const char* getprivate_failure = "line %d %s JS_GetPrivate failed";
static const char* getprivate_failure = "line %d %s %s JS_GetPrivate failed";
static void dbprintf(BOOL error, private_t* p, char* fmt, ...)
{
......
......@@ -55,7 +55,7 @@ typedef struct
} privatemsg_t;
static const char* getprivate_failure = "line %d %s JS_GetPrivate failed";
static const char* getprivate_failure = "line %d %s %s JS_GetPrivate failed";
/* Destructor */
......
/* js_queue.c */
/* Synchronet JavaScript "Queue" Object */
/* $Id$ */
......@@ -48,7 +46,7 @@ typedef struct
link_list_t named_queues;
static const char* getprivate_failure = "line %d %s JS_GetPrivate failed";
static const char* getprivate_failure = "line %d %s %s JS_GetPrivate failed";
/* Queue Destructor */
......
/* js_socket.c */
/* Synchronet JavaScript "Socket" Object */
/* $Id$ */
......@@ -8,7 +6,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2013 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -45,7 +43,7 @@
#ifdef JAVASCRIPT
static const char* getprivate_failure = "line %d %s JS_GetPrivate failed";
static const char* getprivate_failure = "line %d %s %s JS_GetPrivate failed";
static int do_cryptAttribute(const CRYPT_CONTEXT session, CRYPT_ATTRIBUTE_TYPE attr, int val)
{
......
/* logfile.cpp */
/* Synchronet log file routines */
/* $Id$ */
......@@ -265,10 +263,9 @@ void sbbs_t::logch(char ch, bool comma)
/* information, function, action, object and access and then attempts to */
/* write the error information into the file ERROR.LOG and NODE.LOG */
/****************************************************************************/
void sbbs_t::errormsg(int line, const char *source, const char* action, const char *object
,ulong access, const char *extinfo)
void sbbs_t::errormsg(int line, const char* function, const char *src, const char* action, const char *object
,long access, const char *extinfo)
{
const char* src;
char str[2048];
/* prevent recursion */
......@@ -276,18 +273,16 @@ void sbbs_t::errormsg(int line, const char *source, const char* action, const ch
return;
errormsg_inside=true;
/* Don't log path to source code */
src=getfname(source);
safe_snprintf(str,sizeof(str),"ERROR %d (%s) "
#ifdef _WIN32
"(WinError %u) "
#endif
"in %s line %u %s \"%s\" access=%ld %s%s"
"in %s line %u (%s) %s \"%s\" access=%ld %s%s"
,errno,STRERROR(errno)
#ifdef _WIN32
,GetLastError()
#endif
,src, line, action, object, access
,src, line, function, action, object, access
,extinfo==NULL ? "":"info="
,extinfo==NULL ? "":extinfo);
if(online==ON_LOCAL)
......
......@@ -872,8 +872,8 @@ public:
void logofflist(void); /* List of users logon activity */
bool syslog(const char* code, const char *entry);
bool errormsg_inside;
void errormsg(int line, const char *file, const char* action, const char *object
,ulong access, const char *extinfo=NULL);
void errormsg(int line, const char* function, const char *source, const char* action, const char *object
,long access, const char *extinfo=NULL);
BOOL hacklog(char* prot, char* text);
/* qwk.cpp */
......
......@@ -855,7 +855,7 @@ enum { /* Values of mode for userlist function */
#define REALSYSOP (useron.level>=SYSOP_LEVEL)
#define FLAG(x) (ulong)(1UL<<(x-'A'))
#define CLS outchar(FF)
#define WHERE __LINE__,getfname(__FILE__)
#define WHERE __LINE__,__FUNCTION__,getfname(__FILE__)
#define SAVELINE { if(slcnt<SAVE_LINES) { \
slatr[slcnt]=latr; \
slcuratr[slcnt]=curatr; \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment