Fixed existing file check for mbfile adopt and import
This commit is contained in:
@@ -58,7 +58,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
||||
int i, j, k, lines = 0, File_id_cnt = 0, rc;
|
||||
struct FILERecord fdb;
|
||||
|
||||
Syslog('-', "Adopt(%d, %s, %s)", Area, MBSE_SS(File), MBSE_SS(Description));
|
||||
Syslog('f', "Adopt(%d, %s, %s)", Area, MBSE_SS(File), MBSE_SS(Description));
|
||||
|
||||
if (!do_quiet)
|
||||
colour(CYAN, BLACK);
|
||||
@@ -91,7 +91,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
||||
if ((rc = file_cp(temp, temp2))) {
|
||||
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||
if (!do_quiet)
|
||||
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
||||
printf("\nCan't copy file to %s, %s\n", temp2, strerror(rc));
|
||||
die(MBERR_INIT_ERROR);
|
||||
} else {
|
||||
if (do_novir == FALSE) {
|
||||
@@ -108,7 +108,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
||||
chdir(pwd);
|
||||
WriteError("Virus found");
|
||||
if (!do_quiet)
|
||||
printf("Virus found\n");
|
||||
printf("\nVirus found\n");
|
||||
die(MBERR_VIRUS_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
||||
chdir(pwd);
|
||||
WriteError("Virus found");
|
||||
if (!do_quiet)
|
||||
printf("Virus found\n");
|
||||
printf("\nVirus found\n");
|
||||
die(MBERR_VIRUS_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
||||
}
|
||||
|
||||
if (File_Id) {
|
||||
Syslog('-', "FILE_ID.DIZ found");
|
||||
Syslog('f', "FILE_ID.DIZ found");
|
||||
if ((fp = fopen(temp2, "r"))) {
|
||||
/*
|
||||
* Read no more then 25 lines
|
||||
@@ -219,7 +219,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
||||
if (Description == NULL) {
|
||||
WriteError("No FILE_ID.DIZ and no description on the commandline");
|
||||
if (!do_quiet)
|
||||
printf("No FILE_ID.DIZ and no description on the commandline\n");
|
||||
printf("\nNo FILE_ID.DIZ and no description on the commandline\n");
|
||||
DeleteVirusWork();
|
||||
die(MBERR_COMMANDLINE);
|
||||
} else {
|
||||
@@ -303,7 +303,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
||||
} else {
|
||||
WriteError("Area %d is not available", Area);
|
||||
if (!do_quiet)
|
||||
printf("Area %d is not available\n", Area);
|
||||
printf("\nArea %d is not available\n", Area);
|
||||
}
|
||||
|
||||
if (!do_quiet) {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Purpose: File Database Maintenance - Import files with files.bbs
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -59,7 +59,7 @@ void ImportFiles(int Area)
|
||||
struct stat statfile;
|
||||
struct dirent *de;
|
||||
|
||||
Syslog('-', "Import(%d)", Area);
|
||||
Syslog('f', "Import(%d)", Area);
|
||||
|
||||
if (!do_quiet)
|
||||
colour(CYAN, BLACK);
|
||||
|
@@ -153,8 +153,6 @@ void Move(int From, int To, char *File)
|
||||
tothumb = xstrcat(tothumb, fdb.Name);
|
||||
|
||||
if (file_exist(topath, F_OK) == 0) {
|
||||
Syslog('-', "%s", topath);
|
||||
Syslog('-', "%d", file_exist(topath, F_OK));
|
||||
WriteError("File %s already exists in area %d", File, To);
|
||||
if (!do_quiet)
|
||||
printf("File %s already exists in area %d\n", File, To);
|
||||
|
@@ -251,7 +251,7 @@ int UnpackFile(char *File)
|
||||
if (mkdir(temp, 0777)) {
|
||||
WriteError("$Can't create %s", temp);
|
||||
if (!do_quiet)
|
||||
printf("Can't create %s\n", temp);
|
||||
printf("\nCan't create %s\n", temp);
|
||||
die(MBERR_GENERAL);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ int UnpackFile(char *File)
|
||||
if (!getarchiver(unarc)) {
|
||||
WriteError("No archiver available for %s", File);
|
||||
if (!do_quiet)
|
||||
printf("No archiver available for %s\n", File);
|
||||
printf("\nNo archiver available for %s\n", File);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ int UnpackFile(char *File)
|
||||
if ((cmd == NULL) || (cmd == "")) {
|
||||
WriteError("No unarc command available");
|
||||
if (!do_quiet)
|
||||
printf("No unarc command available\n");
|
||||
printf("\nNo unarc command available\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -321,10 +321,18 @@ int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath, cha
|
||||
* 8.3 filename to the long filename.
|
||||
*/
|
||||
mkdirs(DestPath, 0775);
|
||||
|
||||
if (file_exist(DestPath, F_OK) == 0) {
|
||||
WriteError("File %s already exists in area %d", fdb.Name, Area);
|
||||
if (!do_quiet)
|
||||
printf("\nFile %s already exists in area %d\n", fdb.Name, Area);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((rc = file_cp(FromPath, DestPath))) {
|
||||
WriteError("Can't copy file in place");
|
||||
if (!do_quiet)
|
||||
printf("Can't copy file to %s, %s\n", DestPath, strerror(rc));
|
||||
printf("\nCan't copy file to %s, %s\n", DestPath, strerror(rc));
|
||||
return FALSE;
|
||||
}
|
||||
chmod(DestPath, 0644);
|
||||
@@ -332,7 +340,7 @@ int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath, cha
|
||||
if ((rc = symlink(DestPath, LinkPath))) {
|
||||
WriteError("Can't create symbolic link %s", LinkPath);
|
||||
if (!do_quiet)
|
||||
printf("Can't create symbolic link %s, %s\n", LinkPath, strerror(rc));
|
||||
printf("\nCan't create symbolic link %s, %s\n", LinkPath, strerror(rc));
|
||||
unlink(DestPath);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -493,7 +501,7 @@ int LoadAreaRec(int Area)
|
||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||
WriteError("$Can't open %s", sAreas);
|
||||
if (!do_quiet)
|
||||
printf("Can't open %s\n", sAreas);
|
||||
printf("\nCan't open %s\n", sAreas);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -501,7 +509,7 @@ int LoadAreaRec(int Area)
|
||||
if (fseek(pAreas, ((Area - 1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET)) {
|
||||
WriteError("$Can't seek record %d in %s", Area, sAreas);
|
||||
if (!do_quiet)
|
||||
printf("Can't seek record %d in %s\n", Area, sAreas);
|
||||
printf("\nCan't seek record %d in %s\n", Area, sAreas);
|
||||
fclose(pAreas);
|
||||
free(sAreas);
|
||||
return FALSE;
|
||||
@@ -510,7 +518,7 @@ int LoadAreaRec(int Area)
|
||||
if (fread(&area, areahdr.recsize, 1, pAreas) != 1) {
|
||||
WriteError("$Can't read record %d in %s", Area, sAreas);
|
||||
if (!do_quiet)
|
||||
printf("Can't read record %d in %s\n", Area, sAreas);
|
||||
printf("\nCan't read record %d in %s\n", Area, sAreas);
|
||||
fclose(pAreas);
|
||||
free(sAreas);
|
||||
return FALSE;
|
||||
|
Reference in New Issue
Block a user