Commit 139849c0 authored by rswindell's avatar rswindell
Browse files

Log smb.last_error string upon (all) smblib function failures.

parent 8cc12b4d
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 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 *
......@@ -165,13 +165,13 @@ bool sbbs_t::inetmail(char *into, char *subj, long mode)
if((i=smb_create(&smb))!=SMB_SUCCESS) {
smb_close(&smb);
smb_stack(&smb,SMB_STACK_POP);
errormsg(WHERE,ERR_CREATE,smb.file,i);
errormsg(WHERE,ERR_CREATE,smb.file,i,smb.last_error);
return(false); } }
if((i=smb_locksmbhdr(&smb))!=SMB_SUCCESS) {
smb_close(&smb);
smb_stack(&smb,SMB_STACK_POP);
errormsg(WHERE,ERR_LOCK,smb.file,i);
errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error);
return(false); }
length=flength(msgpath)+2; /* +2 for translation string */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 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 *
......@@ -168,12 +168,12 @@ void sbbs_t::readmail(uint usernumber, int which)
msg.idx.subj=mail[smb.curmsg].subj;
if((i=smb_locksmbhdr(&smb))!=0) {
errormsg(WHERE,ERR_LOCK,smb.file,i);
errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error);
break; }
if((i=smb_getstatus(&smb))!=0) {
smb_unlocksmbhdr(&smb);
errormsg(WHERE,ERR_READ,smb.file,i);
errormsg(WHERE,ERR_READ,smb.file,i,smb.last_error);
break; }
smb_unlocksmbhdr(&smb);
......@@ -313,7 +313,7 @@ void sbbs_t::readmail(uint usernumber, int which)
msg.hdr.attr|=MSG_READ;
msg.idx.attr=msg.hdr.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg); }
smb_unlocksmbhdr(&smb); }
if(!msg.total_hfields) { /* unsuccessful reload */
......@@ -411,7 +411,7 @@ void sbbs_t::readmail(uint usernumber, int which)
msg.hdr.attr|=MSG_REPLIED;
msg.idx.attr=msg.hdr.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
}
smb_unlocksmbhdr(&smb);
......@@ -438,7 +438,7 @@ void sbbs_t::readmail(uint usernumber, int which)
msg.idx.attr=msg.hdr.attr;
// mail[smb.curmsg].attr=msg.hdr.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
}
smb_unlocksmbhdr(&smb);
......@@ -474,7 +474,7 @@ void sbbs_t::readmail(uint usernumber, int which)
msg.idx.attr=msg.hdr.attr;
// mail[smb.curmsg].attr=msg.hdr.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
}
smb_unlocksmbhdr(&smb);
......@@ -542,7 +542,7 @@ void sbbs_t::readmail(uint usernumber, int which)
if(loadmsg(&msg,msg.idx.number)) {
msg.hdr.attr=msg.idx.attr=(ushort)i;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
}
smb_unlocksmbhdr(&smb);
......@@ -715,7 +715,7 @@ void sbbs_t::readmail(uint usernumber, int which)
if(cfg.sys_misc&SM_DELEMAIL) {
if((i=smb_locksmbhdr(&smb))!=0) /* Lock the base, so nobody */
errormsg(WHERE,ERR_LOCK,smb.file,i); /* messes with the index */
errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error); /* messes with the index */
else
delmail(usernumber,which); }
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 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 *
......@@ -181,7 +181,7 @@ post_t * sbbs_t::loadposts(int32_t *posts, uint subnum, ulong ptr, long mode)
(*posts)=0;
if((i=smb_locksmbhdr(&smb))!=0) { /* Be sure noone deletes or */
errormsg(WHERE,ERR_LOCK,smb.file,i); /* adds while we're reading */
errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error); /* adds while we're reading */
return(NULL);
}
......@@ -452,13 +452,13 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
if((i=smb_locksmbhdr(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_LOCK,smb.file,i);
errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error);
smb_stack(&smb,SMB_STACK_POP);
return(0);
}
if((i=smb_getstatus(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_READ,smb.file,i);
errormsg(WHERE,ERR_READ,smb.file,i,smb.last_error);
smb_stack(&smb,SMB_STACK_POP);
return(0);
}
......@@ -504,12 +504,12 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
msg.idx.subj=post[smb.curmsg].subj;
if((i=smb_locksmbhdr(&smb))!=0) {
errormsg(WHERE,ERR_LOCK,smb.file,i);
errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error);
break;
}
if((i=smb_getstatus(&smb))!=0) {
smb_unlocksmbhdr(&smb);
errormsg(WHERE,ERR_READ,smb.file,i);
errormsg(WHERE,ERR_READ,smb.file,i,smb.last_error);
break;
}
smb_unlocksmbhdr(&smb);
......@@ -606,7 +606,7 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
msg.hdr.attr|=MSG_READ;
msg.idx.attr=msg.hdr.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
}
smb_unlocksmbhdr(&smb);
......@@ -726,7 +726,7 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
msg.idx.attr^=MSG_DELETE;
msg.hdr.attr=msg.idx.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
if(i==0 && msg.idx.attr&MSG_DELETE) {
sprintf(str,"%s removed post from %s %s"
......@@ -918,7 +918,7 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
if(loadmsg(&msg,msg.idx.number)) {
msg.hdr.attr=msg.idx.attr=i;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
}
smb_unlocksmbhdr(&smb);
......@@ -949,7 +949,7 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
msg.idx.attr|=MSG_DELETE;
msg.hdr.attr=msg.idx.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
}
smb_unlockmsghdr(&smb,&msg);
}
......@@ -982,7 +982,7 @@ int sbbs_t::scanposts(uint subnum, long mode, char *find)
msg.idx.attr|=MSG_VALIDATED;
msg.hdr.attr=msg.idx.attr;
if((i=smb_putmsg(&smb,&msg))!=0)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_unlockmsghdr(&smb,&msg);
}
smb_unlocksmbhdr(&smb);
......
......@@ -164,20 +164,20 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
smb.status.attr=SMB_EMAIL;
if((k=smb_create(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_CREATE,smb.file,k);
errormsg(WHERE,ERR_CREATE,smb.file,k,smb.last_error);
smb_stack(&smb,SMB_STACK_POP);
continue;
}
}
if((k=smb_locksmbhdr(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_LOCK,smb.file,k);
errormsg(WHERE,ERR_LOCK,smb.file,k,smb.last_error);
smb_stack(&smb,SMB_STACK_POP);
continue;
}
if((k=smb_getstatus(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_READ,smb.file,k);
errormsg(WHERE,ERR_READ,smb.file,k,smb.last_error);
smb_stack(&smb,SMB_STACK_POP);
continue;
}
......@@ -254,18 +254,18 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
smb.status.attr=cfg.sub[j]->misc&SUB_HYPER ? SMB_HYPERALLOC :0;
if((k=smb_create(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_CREATE,smb.file,k);
errormsg(WHERE,ERR_CREATE,smb.file,k,smb.last_error);
continue;
}
}
if((k=smb_locksmbhdr(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_LOCK,smb.file,k);
errormsg(WHERE,ERR_LOCK,smb.file,k,smb.last_error);
continue;
}
if((k=smb_getstatus(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_READ,smb.file,k);
errormsg(WHERE,ERR_READ,smb.file,k,smb.last_error);
continue;
}
smb_unlocksmbhdr(&smb);
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 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 *
......@@ -209,20 +209,20 @@ bool sbbs_t::unpack_rep(char* repfile)
smb.status.attr=SMB_EMAIL;
if((k=smb_create(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_CREATE,smb.file,k);
errormsg(WHERE,ERR_CREATE,smb.file,k,smb.last_error);
continue;
}
}
if((k=smb_locksmbhdr(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_LOCK,smb.file,k);
errormsg(WHERE,ERR_LOCK,smb.file,k,smb.last_error);
continue;
}
if((k=smb_getstatus(&smb))!=0) {
smb_close(&smb);
errormsg(WHERE,ERR_READ,smb.file,k);
errormsg(WHERE,ERR_READ,smb.file,k,smb.last_error);
continue;
}
......@@ -423,7 +423,7 @@ bool sbbs_t::unpack_rep(char* repfile)
if((j=smb_create(&smb))!=0) {
smb_close(&smb);
lastsub=INVALID_SUB;
errormsg(WHERE,ERR_CREATE,smb.file,j);
errormsg(WHERE,ERR_CREATE,smb.file,j,smb.last_error);
continue;
}
}
......@@ -431,13 +431,13 @@ bool sbbs_t::unpack_rep(char* repfile)
if((j=smb_locksmbhdr(&smb))!=0) {
smb_close(&smb);
lastsub=INVALID_SUB;
errormsg(WHERE,ERR_LOCK,smb.file,j);
errormsg(WHERE,ERR_LOCK,smb.file,j,smb.last_error);
continue;
}
if((j=smb_getstatus(&smb))!=0) {
smb_close(&smb);
lastsub=INVALID_SUB;
errormsg(WHERE,ERR_READ,smb.file,j);
errormsg(WHERE,ERR_READ,smb.file,j,smb.last_error);
continue;
}
smb_unlocksmbhdr(&smb);
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2007 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 *
......@@ -1074,7 +1074,7 @@ void sbbs_t::forwardmail(smbmsg_t *msg, int usernumber)
if((i=smb_addmsghdr(&smb,msg,SMB_SELFPACK))!=SMB_SUCCESS) {
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
smb_freemsg_dfields(&smb,msg,1);
return;
}
......@@ -1209,12 +1209,12 @@ void sbbs_t::editmsg(smbmsg_t *msg, uint subnum)
length+=2; /* +2 for translation string */
if((i=smb_locksmbhdr(&smb))!=SMB_SUCCESS) {
errormsg(WHERE,ERR_LOCK,smb.file,i);
errormsg(WHERE,ERR_LOCK,smb.file,i,smb.last_error);
return;
}
if((i=smb_getstatus(&smb))!=SMB_SUCCESS) {
errormsg(WHERE,ERR_READ,smb.file,i);
errormsg(WHERE,ERR_READ,smb.file,i,smb.last_error);
return;
}
......@@ -1278,7 +1278,7 @@ void sbbs_t::editmsg(smbmsg_t *msg, uint subnum)
smb_unlocksmbhdr(&smb);
msg->hdr.length=(ushort)smb_getmsghdrlen(msg);
if((i=smb_putmsghdr(&smb,msg))!=SMB_SUCCESS)
errormsg(WHERE,ERR_WRITE,smb.file,i);
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
}
/****************************************************************************/
......
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