Commit 9e46c9ce authored by rswindell's avatar rswindell
Browse files

Improved error log messages:

- include errno description (strerror output)
- exclude (redundant) node number
parent 39a5e80e
......@@ -1396,7 +1396,7 @@ static void send_thread(void* arg)
&& (fp=fopen(xfer.filename,"rb"))==NULL) { /* shareable open failed */
lprintf(LOG_ERR,"%04d <%s> !DATA ERROR %d (%s) line %d opening %s"
,xfer.ctrl_sock, xfer.user->alias, errno, strerror(errno), __LINE__, xfer.filename);
sockprintf(xfer.ctrl_sock,xfer.ctrl_sess,"450 ERROR %d opening %s.",errno,xfer.filename);
sockprintf(xfer.ctrl_sock,xfer.ctrl_sess,"450 ERROR %d (%s) opening %s", errno, strerror(errno), xfer.filename);
if(xfer.tmpfile && !(startup->options&FTP_OPT_KEEP_TEMP_FILES))
ftp_remove(xfer.ctrl_sock, __LINE__, xfer.filename);
ftp_close_socket(xfer.data_sock,xfer.data_sess,__LINE__);
......@@ -1673,7 +1673,7 @@ static void receive_thread(void* arg)
if((fp=fopen(xfer.filename,xfer.append ? "ab" : "wb"))==NULL) {
lprintf(LOG_ERR,"%04d <%s> !DATA ERROR %d (%s) line %d opening %s"
,xfer.ctrl_sock, xfer.user->alias, errno, strerror(errno), __LINE__, xfer.filename);
sockprintf(xfer.ctrl_sock,sess,"450 ERROR %d opening %s.",errno,xfer.filename);
sockprintf(xfer.ctrl_sock,sess,"450 ERROR %d (%s) opening %s", errno, strerror(errno), xfer.filename);
ftp_close_socket(xfer.data_sock,xfer.data_sess,__LINE__);
*xfer.inprogress=FALSE;
thread_down();
......@@ -2313,7 +2313,7 @@ static BOOL ftpalias(char* fullalias, char* filename, user_t* user, client_t* cl
FIND_WHITESPACE(tp);
if(*tp) *tp=0;
if(stricmp(p,alias)) /* Not a match */
if(stricmp(p, alias)) /* Not a match */
continue;
p=tp+1; /* filename */
......@@ -6023,7 +6023,7 @@ void DLLCALL ftp_server(void* arg)
,ctime_r(&t,str),startup->options);
if(chdir(startup->ctrl_dir)!=0)
lprintf(LOG_ERR,"!ERROR %d changing directory to: %s", errno, startup->ctrl_dir);
lprintf(LOG_ERR,"!ERROR %d (%s) changing directory to: %s", errno, strerror(errno), startup->ctrl_dir);
/* Initial configuration and load from CNF files */
SAFECOPY(scfg.ctrl_dir, startup->ctrl_dir);
......
......@@ -1338,7 +1338,7 @@ int main(int argc, char **argv, char** env)
if(daemonize) {
fprintf(statfp,"\nRunning as daemon\n");
if(daemon(TRUE,FALSE)) { /* Daemonize, DON'T switch to / and DO close descriptors */
fprintf(statfp,"!ERROR %d running as daemon\n",errno);
fprintf(statfp,"!ERROR %d (%s) running as daemon\n", errno, strerror(errno));
daemonize=FALSE;
}
}
......
......@@ -817,7 +817,7 @@ static ulong sockmimetext(SOCKET socket, const char* prot, CRYPT_SESSION sess, s
endmime(socket,prot,sess,mime_boundary);
if(msg->hdr.auxattr&MSG_KILLFILE)
if(remove(file_list[i])!=0)
lprintf(LOG_WARNING,"%04u %s !ERROR %d removing %s", socket, prot, errno, file_list[i]);
lprintf(LOG_WARNING,"%04u %s !ERROR %d (%s) removing %s", socket, prot, errno, strerror(errno), file_list[i]);
}
}
}
......@@ -5829,7 +5829,7 @@ void DLLCALL mail_server(void* arg)
,ctime_r(&t,str),startup->options);
if(chdir(startup->ctrl_dir)!=0)
lprintf(LOG_ERR,"!ERROR %d changing directory to: %s", errno, startup->ctrl_dir);
lprintf(LOG_ERR,"!ERROR %d (%s) changing directory to: %s", errno, strerror(errno), startup->ctrl_dir);
/* Initial configuration and load from CNF files */
SAFECOPY(scfg.ctrl_dir,startup->ctrl_dir);
......
......@@ -1288,7 +1288,7 @@ int main(int argc, char** argv)
fclose(fp);
if(chdir(ctrl_dir)!=0) {
sprintf(str,"!ERROR %d changing directory to: %s", errno, ctrl_dir);
sprintf(str,"!ERROR %d (%s) changing directory to: %s", errno, strerror(errno), ctrl_dir);
svc_lputs(NULL,LOG_ERR,str);
}
......
......@@ -1895,7 +1895,7 @@ int main(int argc, char** argv)
SAFECOPY(scfg.ctrl_dir,bbs_startup.ctrl_dir);
if(chdir(scfg.ctrl_dir)!=0)
lprintf(LOG_ERR,"!ERROR %d changing directory to: %s", errno, scfg.ctrl_dir);
lprintf(LOG_ERR,"!ERROR %d (%s) changing directory to: %s", errno, strerror(errno), scfg.ctrl_dir);
scfg.size=sizeof(scfg);
SAFECOPY(error,UNKNOWN_LOAD_ERROR);
......@@ -1946,7 +1946,7 @@ int main(int argc, char** argv)
lprintf(LOG_INFO,"Running as daemon");
if(daemon(TRUE,FALSE)) { /* Daemonize, DON'T switch to / and DO close descriptors */
lprintf(LOG_ERR,"!ERROR %d running as daemon",errno);
lprintf(LOG_ERR,"!ERROR %d (%s) running as daemon", errno, strerror(errno));
is_daemon=FALSE;
}
}
......
......@@ -1513,7 +1513,7 @@ static service_t* read_services_ini(const char* services_ini, service_t* service
char *default_interfaces;
if((fp=fopen(services_ini,"r"))==NULL) {
lprintf(LOG_CRIT,"!ERROR %d opening %s", errno, services_ini);
lprintf(LOG_CRIT,"!ERROR %d (%s) opening %s", errno, strerror(errno), services_ini);
return(NULL);
}
......@@ -1788,7 +1788,7 @@ void DLLCALL services_thread(void* arg)
,ctime_r(&t,str),startup->options);
if(chdir(startup->ctrl_dir)!=0)
lprintf(LOG_ERR,"!ERROR %d changing directory to: %s", errno, startup->ctrl_dir);
lprintf(LOG_ERR,"!ERROR %d (%s) changing directory to: %s", errno, strerror(errno), startup->ctrl_dir);
/* Initial configuration and load from CNF files */
SAFECOPY(scfg.ctrl_dir, startup->ctrl_dir);
......
......@@ -259,7 +259,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
draft_restored = true;
removecase(quotes_fname(useron_xedit, str, sizeof(str)));
} else
lprintf(LOG_ERR, "ERROR %d restoring draft message: %s", errno, draft);
lprintf(LOG_ERR, "ERROR %d (%s) restoring draft message: %s", errno, strerror(errno), draft);
}
else if(mode&WM_QUOTE && !(useron.rest&FLAG('J'))
&& ((mode&(WM_EMAIL|WM_NETMAIL) && cfg.sys_misc&SM_QUOTE_EM)
......@@ -527,7 +527,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
user_set_time_property(&cfg, useron.number, draft_desc, "created", time(NULL));
lprintf(LOG_NOTICE, "draft message saved: %s (%lu bytes)", draft, (ulong)flength(draft));
} else
lprintf(LOG_ERR, "ERROR %d saving draft message: %s", errno, draft);
lprintf(LOG_ERR, "ERROR %d (%s) saving draft message: %s", errno, strerror(errno), draft);
}
if(result != EXIT_SUCCESS || !fexistcase(msgtmp) || !online
......
......@@ -848,7 +848,7 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
,FILE_ATTRIBUTE_NORMAL
,(HANDLE) NULL);
if(wrslot==INVALID_HANDLE_VALUE)
lprintf(LOG_DEBUG,"!ERROR %u opening %s", GetLastError(), str);
lprintf(LOG_DEBUG,"!ERROR %u (%s) opening %s", GetLastError(), strerror(errno), str);
else
lprintf(LOG_DEBUG,"CreateFile(%s)=0x%x", str, wrslot);
}
......@@ -1820,12 +1820,12 @@ int sbbs_t::external(const char* cmdline, long mode, const char* startup_dir)
#endif
execvp(argv[0],argv);
lprintf(LOG_ERR,"Node %d !ERROR %d executing %s",cfg.node_num,errno,argv[0]);
lprintf(LOG_ERR,"!ERROR %d (%s) executing: %s", errno, strerror(errno), argv[0]);
_exit(-1); /* should never get here */
}
if(online==ON_REMOTE)
lprintf(LOG_INFO,"Node %d executing external: %s",cfg.node_num,fullcmdline);
lprintf(LOG_INFO,"executing external: %s", fullcmdline);
/* Disable Ctrl-C checking */
if(!(mode&EX_OFFLINE))
......
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