Fixed several small valgrind detected errors
This commit is contained in:
parent
2ab6cacda9
commit
2e58d4339a
@ -19,6 +19,9 @@ v0.39.4 08-Dec-2003
|
||||
also fixed the message renumbering bug introduced with previous
|
||||
version.
|
||||
|
||||
mbsebbs:
|
||||
A lot of small fixes for problems found with valgrind.
|
||||
|
||||
mbsetup:
|
||||
Added default record for french language.
|
||||
|
||||
|
2
TODO
2
TODO
@ -58,6 +58,8 @@ mbsebbs:
|
||||
|
||||
N: Reimplememnt CHRS kludge.
|
||||
|
||||
N: There are some bugs in the bbs list menu. Make it a door?
|
||||
|
||||
newuser:
|
||||
N: Test with valgrind.
|
||||
|
||||
|
@ -102,7 +102,7 @@ char *xstrcat(char *src, char *add)
|
||||
|
||||
|
||||
|
||||
void InitClient(char *user, char *myname, char *where, char *log, long loggr, char *err, char *mgr, char *debug)
|
||||
void InitClient(char *user, char *myname, char *where, char *logfname, long loggr, char *err, char *mgr, char *debug)
|
||||
{
|
||||
if ((getenv("MBSE_ROOT")) == NULL) {
|
||||
printf("Could not get the MBSE_ROOT environment variable\n");
|
||||
@ -112,7 +112,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch
|
||||
}
|
||||
|
||||
sprintf(progname, "%s", myname);
|
||||
sprintf(logfile, "%s", log);
|
||||
sprintf(logfile, "%s", logfname);
|
||||
sprintf(errfile, "%s", err);
|
||||
sprintf(mgrfile, "%s", mgr);
|
||||
sprintf(logdebug, "%s", debug);
|
||||
|
@ -1112,7 +1112,7 @@ void fill_binkp_list(binkp_list **bll, file_list *fal, off_t offs)
|
||||
|
||||
if (stat(fal->local, &tstat) != 0) {
|
||||
Syslog('!', "$Can't add %s to sendlist", fal->local);
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
if (strstr(fal->remote, (char *)".pkt"))
|
||||
nethold += tstat.st_size;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: File forward to a node
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -71,7 +71,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
T_File.Cost = TIC.FileCost + (TIC.FileCost * nodes.AddPerc / 1000);
|
||||
if ((nodes.Credit < (nodes.StopLevel + T_File.Cost)) && (!TIC.Charge)) {
|
||||
Syslog('!', "No forward to %s, not enough credit left", aka2str(Node));
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -134,7 +134,7 @@ lineedit.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/user
|
||||
mblang.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/mberrors.h
|
||||
mbuser.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbuser.h
|
||||
page.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h
|
||||
bye.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h dispfile.h misc.h language.h bye.h
|
||||
bye.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h
|
||||
funcs.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h ../lib/mberrors.h funcs.h
|
||||
mail.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h
|
||||
newuser.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Intro New BBS at logon
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -598,13 +598,9 @@ void BBS_Show(void)
|
||||
void BBS_Delete(void)
|
||||
{
|
||||
FILE *pBBSLine;
|
||||
int recno = 0;
|
||||
long int offset;
|
||||
int nrecno = 0;
|
||||
char srecno[7];
|
||||
char *sFileName;
|
||||
char stemp[50];
|
||||
char sUser[35];
|
||||
int recno = 0, nrecno = 0;
|
||||
long offset;
|
||||
char srecno[7], *sFileName, stemp[50], sUser[35];
|
||||
|
||||
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(sFileName,"%s/etc/bbslist.data", getenv("MBSE_ROOT"));
|
||||
@ -614,7 +610,6 @@ void BBS_Delete(void)
|
||||
free(sFileName);
|
||||
return;
|
||||
}
|
||||
free(sFileName);
|
||||
fread(&bbshdr, sizeof(bbshdr),1 , pBBSLine);
|
||||
|
||||
if (exitinfo.GraphMode) {
|
||||
@ -657,6 +652,7 @@ void BBS_Delete(void)
|
||||
pout(12, 0, (char *) Language(319));
|
||||
Enter(2);
|
||||
fclose(pBBSLine);
|
||||
free(sFileName);
|
||||
Pause();
|
||||
return;
|
||||
} else {
|
||||
@ -677,6 +673,8 @@ void BBS_Delete(void)
|
||||
/* Record */ /* does not belong to you.*/
|
||||
printf("\n%s%s %s\n\n", (char *) Language(332), stemp, (char *) Language(333));
|
||||
Syslog('!', "User tried to delete somebody else's bbslist record: %s", stemp);
|
||||
free(sFileName);
|
||||
fclose(pBBSLine);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -706,6 +704,7 @@ void BBS_Delete(void)
|
||||
|
||||
fclose(pBBSLine);
|
||||
chmod(sFileName, 0660);
|
||||
free(sFileName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "../lib/clcomm.h"
|
||||
#include "../lib/common.h"
|
||||
#include "../lib/mberrors.h"
|
||||
#include "../lib/nodelist.h"
|
||||
#include "dispfile.h"
|
||||
#include "misc.h"
|
||||
#include "language.h"
|
||||
@ -45,6 +46,9 @@
|
||||
|
||||
extern pid_t mypid;
|
||||
extern time_t t_start;
|
||||
extern char *StartTime;
|
||||
|
||||
|
||||
int do_mailout = FALSE;
|
||||
|
||||
|
||||
@ -129,6 +133,9 @@ void Good_Bye(int onsig)
|
||||
Unsetraw();
|
||||
Free_Language();
|
||||
free(pTTY);
|
||||
if (StartTime)
|
||||
free(StartTime);
|
||||
deinitnl();
|
||||
exit(onsig);
|
||||
}
|
||||
|
||||
@ -152,6 +159,8 @@ void Quick_Bye(int onsig)
|
||||
|
||||
Free_Language();
|
||||
free(pTTY);
|
||||
if (StartTime)
|
||||
free(StartTime);
|
||||
exit(MBERR_OK);
|
||||
}
|
||||
|
||||
|
@ -841,12 +841,14 @@ void Write_Email(void)
|
||||
sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName);
|
||||
} else
|
||||
sprintf(Msg.From, "%s@%s (%s)", exitinfo.Name, CFG.sysdomain, exitinfo.sUserName);
|
||||
|
||||
for (i = 0; i < strlen(Msg.From); i++) {
|
||||
if (Msg.From[i] == ' ')
|
||||
Msg.From[i] = '_';
|
||||
if (Msg.From[i] == '@')
|
||||
break;
|
||||
}
|
||||
|
||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||
printf("%s", Msg.From);
|
||||
Syslog('b', "Setting From: %s", Msg.From);
|
||||
@ -862,6 +864,7 @@ void Write_Email(void)
|
||||
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||
free(Message[i]);
|
||||
SetEmailArea(orgbox);
|
||||
free(orgbox);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -883,6 +886,7 @@ void Write_Email(void)
|
||||
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||
free(Message[i]);
|
||||
SetEmailArea(orgbox);
|
||||
free(orgbox);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -897,6 +901,7 @@ void Write_Email(void)
|
||||
free(Message[i]);
|
||||
|
||||
SetEmailArea(orgbox);
|
||||
free(orgbox);
|
||||
}
|
||||
|
||||
|
||||
|
@ -297,12 +297,12 @@ void Download(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(tf);
|
||||
|
||||
/*
|
||||
* If anything left to download...
|
||||
*/
|
||||
if (!Count) {
|
||||
fclose(tf);
|
||||
SetFileArea(OldArea);
|
||||
unlink("taglist");
|
||||
/* No files marked for download */
|
||||
@ -458,6 +458,7 @@ void Download(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(tf);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -899,8 +900,7 @@ int NewfileScan(int AskStart)
|
||||
|
||||
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
|
||||
|
||||
if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) &&
|
||||
(strlen(area.Password) == 0) && (area.New)) {
|
||||
if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) && (strlen(area.Password) == 0) && (area.New)) {
|
||||
|
||||
if ((pFile = OpenFileBase(arecno, FALSE)) != NULL ) {
|
||||
|
||||
@ -928,6 +928,8 @@ int NewfileScan(int AskStart)
|
||||
if (iLC(2) == 1) {
|
||||
free(Date);
|
||||
free(temp);
|
||||
fclose(pFile);
|
||||
fclose(pAreas);
|
||||
return 1;
|
||||
}
|
||||
Found = TRUE;
|
||||
@ -946,6 +948,8 @@ int NewfileScan(int AskStart)
|
||||
if (ShowOneFile() == 1) {
|
||||
free(Date);
|
||||
free(temp);
|
||||
fclose(pFile);
|
||||
fclose(pAreas);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -962,6 +966,7 @@ int NewfileScan(int AskStart)
|
||||
if (iLC(2) == 1) {
|
||||
free(Date);
|
||||
free(temp);
|
||||
fclose(pAreas);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -225,6 +225,13 @@ int Crash_Option(faddr *Dest)
|
||||
printf("%c", Keystroke(462, 1));
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
if (Nlent->addr.domain)
|
||||
free(Nlent->addr.domain);
|
||||
Nlent->addr.domain = NULL;
|
||||
if (Nlent->url)
|
||||
free(Nlent->url);
|
||||
Nlent->url = NULL;
|
||||
}
|
||||
|
||||
Dest->point = point;
|
||||
@ -399,7 +406,7 @@ void Post_Msg()
|
||||
int i, x, cc;
|
||||
char *FidoNode;
|
||||
faddr *Dest = NULL;
|
||||
node *Nlent;
|
||||
node *Nlent = NULL;
|
||||
unsigned short point;
|
||||
|
||||
Line = 1;
|
||||
@ -505,6 +512,13 @@ void Post_Msg()
|
||||
point = Dest->point;
|
||||
Dest->point = 0;
|
||||
if (((Nlent = getnlent(Dest)) != NULL) && (Nlent->addr.zone)) {
|
||||
if (Nlent->url)
|
||||
free(Nlent->url);
|
||||
Nlent->url = NULL;
|
||||
if (Nlent->addr.domain)
|
||||
free(Nlent->addr.domain);
|
||||
Nlent->addr.domain = NULL;
|
||||
|
||||
colour(YELLOW, BLACK);
|
||||
if (point)
|
||||
printf("Boss : ");
|
||||
@ -577,6 +591,7 @@ void Post_Msg()
|
||||
if (toupper(Getone()) == Keystroke(162, 0)) {
|
||||
for(i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||
free(Message[i]);
|
||||
tidy_faddr(Dest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -642,6 +657,7 @@ void Post_Msg()
|
||||
|
||||
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||
free(Message[i]);
|
||||
tidy_faddr(Dest);
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,9 +143,9 @@ int main(int argc, char **argv)
|
||||
* Trap signals
|
||||
*/
|
||||
for(i = 0; i < NSIG; i++) {
|
||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||
signal(i, SIG_IGN);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Misc functions
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -62,52 +62,51 @@ int LC_Door = FALSE;
|
||||
|
||||
int ChkFiles()
|
||||
{
|
||||
FILE *pCallerLog, *pUsersFile;
|
||||
char *sDataFile;
|
||||
time_t Now;
|
||||
FILE *fp;
|
||||
char *temp;
|
||||
time_t Now;
|
||||
|
||||
sDataFile = calloc(PATH_MAX, sizeof(char));
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
||||
chmod(sDataFile, 0660);
|
||||
|
||||
/*
|
||||
* Check if users.data exists, if not create a new one.
|
||||
*/
|
||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||
if ((pUsersFile = fopen(temp,"rb")) == NULL) {
|
||||
if((pUsersFile = fopen(temp,"wb")) == NULL) {
|
||||
if ((fp = fopen(temp,"rb")) == NULL) {
|
||||
if ((fp = fopen(temp,"wb")) == NULL) {
|
||||
WriteError("$Can't create %s", temp);
|
||||
ExitClient(MBERR_INIT_ERROR);
|
||||
} else {
|
||||
usrconfighdr.hdrsize = sizeof(usrconfighdr);
|
||||
usrconfighdr.recsize = sizeof(usrconfig);
|
||||
fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, pUsersFile);
|
||||
fclose(pUsersFile);
|
||||
fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
} else {
|
||||
fclose(fp);
|
||||
}
|
||||
chmod(temp, 0660);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if sysinfo.data exists, if not, create a new one.
|
||||
*/
|
||||
if ((pCallerLog = fopen(sDataFile, "rb")) == NULL) {
|
||||
if((pCallerLog = fopen(sDataFile, "wb")) == NULL)
|
||||
WriteError("$ChkFiles: Can't create %s", sDataFile);
|
||||
else {
|
||||
sprintf(temp, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
||||
if ((fp = fopen(temp, "rb")) == NULL) {
|
||||
if ((fp = fopen(temp, "wb")) == NULL) {
|
||||
WriteError("$ChkFiles: Can't create %s", temp);
|
||||
} else {
|
||||
memset((char *)&SYSINFO, 0, sizeof(SYSINFO));
|
||||
Now = time(NULL);
|
||||
SYSINFO.StartDate = Now;
|
||||
fwrite(&SYSINFO, sizeof(SYSINFO), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
} else {
|
||||
fclose(fp);
|
||||
}
|
||||
chmod(temp, 0660);
|
||||
|
||||
rewind(pCallerLog);
|
||||
fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
|
||||
fclose(pCallerLog);
|
||||
chmod(sDataFile, 0660);
|
||||
}
|
||||
}
|
||||
free(temp);
|
||||
free(sDataFile);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -150,14 +149,11 @@ void Setup(char *Option, char *variable)
|
||||
void SaveLastCallers()
|
||||
{
|
||||
FILE *pGLC;
|
||||
char *sFileName;
|
||||
char sFileDate[9];
|
||||
char sDate[9];
|
||||
char *sFileName, sFileDate[9], sDate[9];
|
||||
struct stat statfile;
|
||||
|
||||
/*
|
||||
* First check if we passed midnight, in that case we
|
||||
* create a fresh file.
|
||||
* First check if we passed midnight, in that case we create a fresh file.
|
||||
*/
|
||||
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
|
||||
@ -172,20 +168,24 @@ void SaveLastCallers()
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if file exists, if not create the file and
|
||||
* write the fileheader.
|
||||
* Check if file exists, if not create the file and write the fileheader.
|
||||
*/
|
||||
if ((pGLC = fopen(sFileName, "r")) == NULL) {
|
||||
if ((pGLC = fopen(sFileName, "w")) != NULL) {
|
||||
LCALLhdr.hdrsize = sizeof(LCALLhdr);
|
||||
LCALLhdr.recsize = sizeof(LCALL);
|
||||
fwrite(&LCALLhdr, sizeof(LCALLhdr), 1, pGLC);
|
||||
fclose(pGLC);
|
||||
Syslog('+', "Created new lastcall.data");
|
||||
}
|
||||
} else {
|
||||
fclose(pGLC);
|
||||
}
|
||||
chmod(sFileName, 0660);
|
||||
|
||||
/*
|
||||
* Now append a record
|
||||
*/
|
||||
if ((pGLC = fopen(sFileName,"a+")) == NULL) {
|
||||
WriteError("$Can't open %s", sFileName);
|
||||
return;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Offline Reader
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -2544,13 +2544,13 @@ union Converter {
|
||||
|
||||
float IEEToMSBIN(float f)
|
||||
{
|
||||
int sign, exp;
|
||||
int sign, expo;
|
||||
union Converter t;
|
||||
|
||||
t.f[0] = f;
|
||||
sign = t.uc[3] / 0x80;
|
||||
exp = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF;
|
||||
t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (exp << 8);
|
||||
expo = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF;
|
||||
t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (expo << 8);
|
||||
|
||||
return t.f[0];
|
||||
}
|
||||
@ -2560,12 +2560,12 @@ float IEEToMSBIN(float f)
|
||||
float MSBINToIEEE(float f)
|
||||
{
|
||||
union Converter t;
|
||||
int sign, exp;
|
||||
int sign, expo;
|
||||
|
||||
t.f[0] = f;
|
||||
sign = t.uc[2] / 0x80;
|
||||
exp = (t.uc[3] - 0x81 + 0x7f) & 0xff;
|
||||
t.ui[1] = (t.ui[1] & 0x7f) | (exp << 7) | (sign << 15);
|
||||
expo = (t.uc[3] - 0x81 + 0x7f) & 0xff;
|
||||
t.ui[1] = (t.ui[1] & 0x7f) | (expo << 7) | (sign << 15);
|
||||
return t.f[0];
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Oneliner functions.
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -51,7 +51,7 @@ void Oneliner_Check()
|
||||
FILE *pOneline;
|
||||
char *sFileName;
|
||||
|
||||
sFileName = calloc(128, sizeof(char));
|
||||
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(sFileName, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||
|
||||
if ((pOneline = fopen(sFileName, "r")) == NULL) {
|
||||
@ -60,10 +60,13 @@ void Oneliner_Check()
|
||||
olhdr.recsize = sizeof(ol);
|
||||
fwrite(&olhdr, sizeof(olhdr), 1, pOneline);
|
||||
fclose(pOneline);
|
||||
chmod(sFileName, 0660);
|
||||
Syslog('-', "Created oneliner database");
|
||||
}
|
||||
} else {
|
||||
fclose(pOneline);
|
||||
}
|
||||
|
||||
chmod(sFileName, 0660);
|
||||
free(sFileName);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
extern int sock;
|
||||
extern pid_t mypid;
|
||||
char *StartTime;
|
||||
char *StartTime = NULL;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -352,7 +352,7 @@ void chat_cleanuser(pid_t pid)
|
||||
void chat_msg(int channel, char *nick, char *msg)
|
||||
{
|
||||
int i;
|
||||
char buf[128], *log;
|
||||
char buf[128], *logm;
|
||||
|
||||
if (nick == NULL)
|
||||
sprintf(buf, "%s", msg);
|
||||
@ -360,10 +360,10 @@ void chat_msg(int channel, char *nick, char *msg)
|
||||
sprintf(buf, "<%s> %s", nick, msg);
|
||||
|
||||
if (CFG.iAutoLog && strlen(CFG.chat_log)) {
|
||||
log = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(log, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||
ulog(log, (char *)"+", chat_channels[channel].name, (char *)"-1", buf);
|
||||
free(log);
|
||||
logm = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(logm, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||
ulog(logm, (char *)"+", chat_channels[channel].name, (char *)"-1", buf);
|
||||
free(logm);
|
||||
}
|
||||
buf[79] = '\0';
|
||||
|
||||
|
@ -422,7 +422,7 @@ char *reg_ipm(char *data)
|
||||
*/
|
||||
int reg_spm(char *data)
|
||||
{
|
||||
char *cnt, *from, *too, *txt, *log;
|
||||
char *cnt, *from, *too, *txt, *logm;
|
||||
int i;
|
||||
|
||||
cnt = strtok(data, ",");
|
||||
@ -463,10 +463,10 @@ int reg_spm(char *data)
|
||||
reginfo[i].ismsg = TRUE;
|
||||
|
||||
if (CFG.iAutoLog && strlen(CFG.chat_log)) {
|
||||
log = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(log, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||
ulog(log, (char *)"+", from, (char *)"-1", txt);
|
||||
free(log);
|
||||
logm = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(logm, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||
ulog(logm, (char *)"+", from, (char *)"-1", txt);
|
||||
free(logm);
|
||||
}
|
||||
|
||||
Syslog('+', "reg_spm: rec=%d in=%d out=%d ismsg=%d", i, reginfo[i].ptr_in, reginfo[i].ptr_out, reginfo[i].ismsg);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: MBSE BBS Task Manager, utilities
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2001
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -194,30 +194,30 @@ void Syslog(int grade, const char *format, ...)
|
||||
int ulog(char *fn, char *grade, char *prname, char *prpid, char *format)
|
||||
{
|
||||
int i, oldmask;
|
||||
FILE *log;
|
||||
FILE *fp;
|
||||
|
||||
oldmask = umask(066);
|
||||
log = fopen(fn, "a");
|
||||
fp = fopen(fn, "a");
|
||||
umask(oldmask);
|
||||
if (log == NULL) {
|
||||
if (fp == NULL) {
|
||||
oserr = errno;
|
||||
Syslog('!', "$Cannot open user logfile %s", fn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fprintf(log, "%s %s %s[%s] ", grade, date(), prname, prpid);
|
||||
fprintf(fp, "%s %s %s[%s] ", grade, date(), prname, prpid);
|
||||
for (i = 0; i < strlen(format); i++) {
|
||||
if (iscntrl(format[i])) {
|
||||
fputc('^', log);
|
||||
fputc(format[i] + 64, log);
|
||||
fputc('^', fp);
|
||||
fputc(format[i] + 64, fp);
|
||||
} else {
|
||||
fputc(format[i], log);
|
||||
fputc(format[i], fp);
|
||||
}
|
||||
}
|
||||
fputc('\n', log);
|
||||
fflush(log);
|
||||
fputc('\n', fp);
|
||||
fflush(fp);
|
||||
|
||||
if (fclose(log) != 0) {
|
||||
if (fclose(fp) != 0) {
|
||||
oserr = errno;
|
||||
Syslog('!', "$Cannot close user logfile %s", fn);
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user