Improved error logging
This commit is contained in:
parent
a7545f2b10
commit
909f055c55
@ -4767,6 +4767,7 @@ v0.33.20 10-Feb-2002
|
|||||||
The hatch and magic processors now scan the filenames to test
|
The hatch and magic processors now scan the filenames to test
|
||||||
using the regexp library, this should be more reliable.
|
using the regexp library, this should be more reliable.
|
||||||
Increased the size of the buffer for filesort.
|
Increased the size of the buffer for filesort.
|
||||||
|
Improved error reporting when file copy fails.
|
||||||
|
|
||||||
mbmsg:
|
mbmsg:
|
||||||
When creating non-existend message bases, the path is created
|
When creating non-existend message bases, the path is created
|
||||||
@ -4801,6 +4802,7 @@ v0.33.20 10-Feb-2002
|
|||||||
|
|
||||||
mbdiff:
|
mbdiff:
|
||||||
Removed nonsense error message when stopped on a signal.
|
Removed nonsense error message when stopped on a signal.
|
||||||
|
Improved error reporting when copy fails.
|
||||||
|
|
||||||
mbindex:
|
mbindex:
|
||||||
Removed nonsense error message when stopped on a signal.
|
Removed nonsense error message when stopped on a signal.
|
||||||
|
@ -53,7 +53,7 @@ extern int tic_imp;
|
|||||||
int Add_BBS()
|
int Add_BBS()
|
||||||
{
|
{
|
||||||
struct FILERecord frec;
|
struct FILERecord frec;
|
||||||
int i, Insert, Done = FALSE, Found = FALSE;
|
int rc, i, Insert, Done = FALSE, Found = FALSE;
|
||||||
char fdbname[PATH_MAX], fdbtemp[PATH_MAX];
|
char fdbname[PATH_MAX], fdbtemp[PATH_MAX];
|
||||||
char temp1[PATH_MAX], temp2[PATH_MAX], *fname;
|
char temp1[PATH_MAX], temp2[PATH_MAX], *fname;
|
||||||
FILE *fdb, *fdt;
|
FILE *fdb, *fdt;
|
||||||
@ -87,8 +87,8 @@ int Add_BBS()
|
|||||||
sprintf(temp2, "%s/%s", TIC.BBSpath, TIC.NewName);
|
sprintf(temp2, "%s/%s", TIC.BBSpath, TIC.NewName);
|
||||||
mkdirs(temp2, 0755);
|
mkdirs(temp2, 0755);
|
||||||
|
|
||||||
if (file_cp(temp1, temp2) != 0) {
|
if ((rc = file_cp(temp1, temp2))) {
|
||||||
WriteError("$Copy to %s failed", temp2);
|
WriteError("Copy to %s failed: %s", temp2, strerror(rc));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
chmod(temp2, 0644);
|
chmod(temp2, 0644);
|
||||||
|
@ -269,7 +269,7 @@ void Magic_ExecCommand(void)
|
|||||||
|
|
||||||
void Magic_CopyFile(void)
|
void Magic_CopyFile(void)
|
||||||
{
|
{
|
||||||
int First = TRUE;
|
int First = TRUE, rc;
|
||||||
char *From, *To;
|
char *From, *To;
|
||||||
|
|
||||||
From = calloc(PATH_MAX, sizeof(char));
|
From = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -280,11 +280,11 @@ void Magic_CopyFile(void)
|
|||||||
sprintf(From, "%s/%s", TIC.BBSpath, TIC.NewName);
|
sprintf(From, "%s/%s", TIC.BBSpath, TIC.NewName);
|
||||||
sprintf(To, "%s/%s", magic.Path, TIC.NewName);
|
sprintf(To, "%s/%s", magic.Path, TIC.NewName);
|
||||||
|
|
||||||
if (file_cp(From, To) == 0) {
|
if ((rc = file_cp(From, To) == 0)) {
|
||||||
MagicResult((char *)"%s copied to %s", From, To);
|
MagicResult((char *)"%s copied to %s", From, To);
|
||||||
Magic_CheckCompile();
|
Magic_CheckCompile();
|
||||||
} else
|
} else
|
||||||
WriteError("Magic: copy: %s to %s failed");
|
WriteError("Magic: copy: %s to %s failed, %s", strerror(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
free(From);
|
free(From);
|
||||||
@ -296,9 +296,9 @@ void Magic_CopyFile(void)
|
|||||||
void Magic_UnpackFile(void)
|
void Magic_UnpackFile(void)
|
||||||
{
|
{
|
||||||
int rc, First = TRUE;
|
int rc, First = TRUE;
|
||||||
char *buf = NULL, *unarc = NULL, *cmd = NULL;
|
char *Fn, *buf = NULL, *unarc = NULL, *cmd = NULL;
|
||||||
char Fn[PATH_MAX];
|
|
||||||
|
|
||||||
|
Fn = calloc(PATH_MAX, sizeof(char));
|
||||||
while (GetMagicRec(MG_UNPACK, First)) {
|
while (GetMagicRec(MG_UNPACK, First)) {
|
||||||
First = FALSE;
|
First = FALSE;
|
||||||
buf = calloc(PATH_MAX, sizeof(char));
|
buf = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -328,6 +328,7 @@ void Magic_UnpackFile(void)
|
|||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
free(Fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -334,12 +334,12 @@ int main(int argc, char **argv)
|
|||||||
die(100);
|
die(100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (file_cp(nd, ond)) {
|
if ((rc = file_cp(nd, ond))) {
|
||||||
show_log = TRUE;
|
show_log = TRUE;
|
||||||
free(ond);
|
free(ond);
|
||||||
free(onl);
|
free(onl);
|
||||||
free(wrk);
|
free(wrk);
|
||||||
WriteError("$Copy %s failed", nd);
|
WriteError("Copy %s failed, %s", nd, strerror(rc));
|
||||||
die(100);
|
die(100);
|
||||||
}
|
}
|
||||||
Syslog('s', "Copied %s", nd);
|
Syslog('s', "Copied %s", nd);
|
||||||
|
@ -84,7 +84,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), File);
|
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), File);
|
||||||
mkdirs(temp2, 0755);
|
mkdirs(temp2, 0755);
|
||||||
if ((rc = file_cp(temp, temp2))) {
|
if ((rc = file_cp(temp, temp2))) {
|
||||||
WriteError("Can't copy file to %s", temp2);
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
||||||
die(0);
|
die(0);
|
||||||
|
@ -105,7 +105,7 @@ void ImportFiles(int Area)
|
|||||||
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), fdb.LName);
|
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), fdb.LName);
|
||||||
mkdirs(temp2, 0755);
|
mkdirs(temp2, 0755);
|
||||||
if ((rc = file_cp(temp, temp2))) {
|
if ((rc = file_cp(temp, temp2))) {
|
||||||
WriteError("Can't copy file to %s", temp2);
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
||||||
Doit = FALSE;
|
Doit = FALSE;
|
||||||
@ -305,8 +305,8 @@ void ImportFiles(int Area)
|
|||||||
Syslog('+', "Unknown archive format %s", temp);
|
Syslog('+', "Unknown archive format %s", temp);
|
||||||
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), fdb.LName);
|
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), fdb.LName);
|
||||||
mkdirs(temp2, 0755);
|
mkdirs(temp2, 0755);
|
||||||
if (file_cp(temp, temp2)) {
|
if ((rc = file_cp(temp, temp2))) {
|
||||||
WriteError("Can't copy file to %s", temp2);
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
Doit = FALSE;
|
Doit = FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
|
@ -188,8 +188,8 @@ void Kill(void)
|
|||||||
fwrite(&file, sizeof(file), 1, pFile);
|
fwrite(&file, sizeof(file), 1, pFile);
|
||||||
iMoved++;
|
iMoved++;
|
||||||
} else {
|
} else {
|
||||||
WriteError("Move %s to area %d failed rc = %d",
|
WriteError("Move %s to area %d failed, %s",
|
||||||
file.Name, area.MoveArea, rc);
|
file.Name, area.MoveArea, strerror(rc));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Syslog('+', "Delete %s, area %d", file.LName, i);
|
Syslog('+', "Delete %s, area %d", file.LName, i);
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
void mover(char *fn)
|
void mover(char *fn)
|
||||||
{
|
{
|
||||||
char *From, *To;
|
char *From, *To;
|
||||||
|
int rc;
|
||||||
|
|
||||||
From = calloc(PATH_MAX, sizeof(char));
|
From = calloc(PATH_MAX, sizeof(char));
|
||||||
To = calloc(PATH_MAX, sizeof(char));
|
To = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -51,8 +52,10 @@ void mover(char *fn)
|
|||||||
Syslog('!', "Moving %s to %s", From, To);
|
Syslog('!', "Moving %s to %s", From, To);
|
||||||
|
|
||||||
if (mkdirs(To, 0770)) {
|
if (mkdirs(To, 0770)) {
|
||||||
if (file_mv(From, To) != 0)
|
if ((rc = file_mv(From, To)))
|
||||||
WriteError("$Failed to move %s to %s", From, To);
|
WriteError("$Failed to move %s to %s: %s", From, To, strerror(rc));
|
||||||
|
} else {
|
||||||
|
WriteError("$Can't create directory for %s", To);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(From);
|
free(From);
|
||||||
|
@ -75,7 +75,7 @@ int ProcessTic(fa_list *sbl)
|
|||||||
int DownLinks = 0;
|
int DownLinks = 0;
|
||||||
int MustRearc = FALSE;
|
int MustRearc = FALSE;
|
||||||
int UnPacked = FALSE, IsArchive = FALSE;
|
int UnPacked = FALSE, IsArchive = FALSE;
|
||||||
int i, j, k, File_Id = FALSE;
|
int rc, i, j, k, File_Id = FALSE;
|
||||||
char *Temp, *unarc = NULL, *cmd = NULL;
|
char *Temp, *unarc = NULL, *cmd = NULL;
|
||||||
char temp1[PATH_MAX], temp2[PATH_MAX], sbe[24], TDesc[256];
|
char temp1[PATH_MAX], temp2[PATH_MAX], sbe[24], TDesc[256];
|
||||||
unsigned long crc, crc2, Kb;
|
unsigned long crc, crc2, Kb;
|
||||||
@ -235,7 +235,7 @@ int ProcessTic(fa_list *sbl)
|
|||||||
Magic_Keepnum();
|
Magic_Keepnum();
|
||||||
|
|
||||||
if (!tic.FileArea) {
|
if (!tic.FileArea) {
|
||||||
Syslog('f', "Passthru area!");
|
Syslog('+', "Passthru TIC area!");
|
||||||
strcpy(TIC.BBSpath, CFG.ticout);
|
strcpy(TIC.BBSpath, CFG.ticout);
|
||||||
strcpy(TIC.BBSdesc, tic.Comment);
|
strcpy(TIC.BBSdesc, tic.Comment);
|
||||||
} else {
|
} else {
|
||||||
@ -276,7 +276,7 @@ int ProcessTic(fa_list *sbl)
|
|||||||
* the area is not linked to an existing BBS area.
|
* the area is not linked to an existing BBS area.
|
||||||
*/
|
*/
|
||||||
if (tic.FileArea && access(TIC.BBSpath, W_OK)) {
|
if (tic.FileArea && access(TIC.BBSpath, W_OK)) {
|
||||||
WriteError("$No write access to \"%s\"", TIC.BBSpath);
|
WriteError("No write access to \"%s\"", TIC.BBSpath);
|
||||||
Bad((char *)"Dest directory not available");
|
Bad((char *)"Dest directory not available");
|
||||||
free(Temp);
|
free(Temp);
|
||||||
return 1;
|
return 1;
|
||||||
@ -406,10 +406,10 @@ int ProcessTic(fa_list *sbl)
|
|||||||
if (((tic.SendOrg) && (MustRearc || strlen(tic.Banner))) || (!tic.FileArea)) {
|
if (((tic.SendOrg) && (MustRearc || strlen(tic.Banner))) || (!tic.FileArea)) {
|
||||||
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
|
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
|
||||||
sprintf(temp2, "%s/%s", CFG.ticout, TIC.RealName);
|
sprintf(temp2, "%s/%s", CFG.ticout, TIC.RealName);
|
||||||
if (file_cp(temp1, temp2) == 0) {
|
if ((rc = file_cp(temp1, temp2) == 0)) {
|
||||||
TIC.SendOrg = TRUE;
|
TIC.SendOrg = TRUE;
|
||||||
} else {
|
} else {
|
||||||
WriteError("$Copy %s to %s failed", temp1, temp2);
|
WriteError("Copy %s to %s failed: %s", temp1, temp2, strerror(rc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,12 +492,10 @@ int ProcessTic(fa_list *sbl)
|
|||||||
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
|
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
|
||||||
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.RealName);
|
sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.RealName);
|
||||||
|
|
||||||
if (file_cp(temp1, temp2)) {
|
if ((rc = file_cp(temp1, temp2))) {
|
||||||
WriteError("Can't copy %s to %s", temp1, temp2);
|
WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc));
|
||||||
free(Temp);
|
free(Temp);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
Syslog('f', "file_cp(%s, %s) ok", temp1, temp2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(temp2, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
sprintf(temp2, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
||||||
@ -704,7 +702,9 @@ int ProcessTic(fa_list *sbl)
|
|||||||
strncpy(T_File.LDesc[i], TIC.File_Id[i], 48);
|
strncpy(T_File.LDesc[i], TIC.File_Id[i], 48);
|
||||||
T_File.TotLdesc = TIC.File_Id_Ct;
|
T_File.TotLdesc = TIC.File_Id_Ct;
|
||||||
T_File.Announce = tic.Announce;
|
T_File.Announce = tic.Announce;
|
||||||
strncpy(T_File.Name, TIC.NewName, 12);
|
sprintf(Temp, "%s", TIC.NewName);
|
||||||
|
name_mangle(Temp);
|
||||||
|
strncpy(T_File.Name, Temp, 12);
|
||||||
strncpy(T_File.LName, TIC.NewName, 80);
|
strncpy(T_File.LName, TIC.NewName, 80);
|
||||||
T_File.Fdate = TIC.FileDate;
|
T_File.Fdate = TIC.FileDate;
|
||||||
T_File.Cost = TIC.TicIn.Cost;
|
T_File.Cost = TIC.TicIn.Cost;
|
||||||
@ -772,15 +772,11 @@ int ProcessTic(fa_list *sbl)
|
|||||||
Magic_CopyFile();
|
Magic_CopyFile();
|
||||||
Magic_UnpackFile();
|
Magic_UnpackFile();
|
||||||
Magic_AdoptFile();
|
Magic_AdoptFile();
|
||||||
Syslog('f', "Almost at end of ptic");
|
|
||||||
|
|
||||||
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicName);
|
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicName);
|
||||||
Syslog('f', "About to erase \"%s\"", Temp);
|
|
||||||
|
|
||||||
unlink(Temp);
|
unlink(Temp);
|
||||||
Syslog('f', "Done, about to free Temp");
|
|
||||||
free(Temp);
|
free(Temp);
|
||||||
Syslog('f', "Done with ptic");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,8 +400,8 @@ int LoadTic(char *inb, char *tfn)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
sprintf(Temp2, "%s/%s", TIC.Inbound, TIC.TicIn.FullName);
|
sprintf(Temp2, "%s/%s", TIC.Inbound, TIC.TicIn.FullName);
|
||||||
if (file_mv(Temp, Temp2)) {
|
if ((rc = file_mv(Temp, Temp2))) {
|
||||||
WriteError("Can't move %s to inbound", Temp);
|
WriteError("Can't move %s to inbound: %s", Temp, strerror(rc));
|
||||||
tidy_falist(&sbl);
|
tidy_falist(&sbl);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user