Fixed duplicate newfiles bug
This commit is contained in:
@@ -35,7 +35,7 @@ MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o virscan.o tracker.o
|
||||
postecho.o backalias.o createm.o createf.o msgflags.o dirsession.o \
|
||||
queue.o dirlock.o qualify.o
|
||||
MBSEQ_OBJS = mbseq.o
|
||||
MBAFF_OBJS = announce.o fflist.o filefind.o grlist.o mbaff.o msgutil.o
|
||||
MBAFF_OBJS = announce.o fflist.o filefind.o grlist.o mbaff.o msgutil.o toberep.o
|
||||
MBINDEX_OBJS = mbindex.o
|
||||
MBDIFF_OBJS = mbdiff.o
|
||||
MBFILE_OBJS = mbfile.o mbfkill.o mbfutil.o mbfindex.o mbfcheck.o mbfpack.o mbflist.o mbfadopt.o \
|
||||
@@ -153,7 +153,7 @@ post.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h
|
||||
rnews.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbinet.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h rfc2ftn.h mbfido.h ../paths.h rnews.h
|
||||
storenet.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h msgflags.h rollover.h storenet.h
|
||||
utic.o: ../config.h ../lib/mbselib.h tic.h mover.h tic.h utic.h
|
||||
announce.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h
|
||||
announce.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h toberep.h announce.h
|
||||
fflist.o: ../config.h ../lib/mbselib.h ../lib/msg.h fflist.h
|
||||
ftn2rfc.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h rollover.h aliasdb.h postemail.h backalias.h msgflags.h ftn2rfc.h
|
||||
makestat.o: ../config.h ../lib/mbselib.h ../lib/diesel.h ../lib/msg.h mgrutil.h makestat.h
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "../lib/diesel.h"
|
||||
#include "grlist.h"
|
||||
#include "msgutil.h"
|
||||
#include "toberep.h"
|
||||
#include "announce.h"
|
||||
|
||||
|
||||
@@ -48,45 +49,6 @@ int MsgCount; /* Message counter */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Add a file whos data is in T_File to the toberep.data file.
|
||||
*/
|
||||
int Add_ToBeRep(void);
|
||||
int Add_ToBeRep()
|
||||
{
|
||||
char *fname;
|
||||
struct _filerecord Temp;
|
||||
FILE *tbr;
|
||||
int Found = FALSE;
|
||||
|
||||
fname = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(fname, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
||||
if ((tbr = fopen(fname, "a+")) == NULL) {
|
||||
WriteError("$Can't create %s", fname);
|
||||
free(fname);
|
||||
return FALSE;
|
||||
}
|
||||
free(fname);
|
||||
|
||||
fseek(tbr, 0, SEEK_SET);
|
||||
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
|
||||
if ((strcmp(Temp.Name, T_File.Name) == 0) && (Temp.Fdate = T_File.Fdate))
|
||||
Found = TRUE;
|
||||
}
|
||||
|
||||
if (Found) {
|
||||
Syslog('!', "File %s already in toberep.data", T_File.Name);
|
||||
fclose(tbr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fwrite(&T_File, sizeof(T_File), 1, tbr);
|
||||
fclose(tbr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Check for uploads, these are files in the files database with
|
||||
* the announced flag not yet set.
|
||||
|
@@ -31,8 +31,6 @@
|
||||
#include "../config.h"
|
||||
#include "../lib/mbselib.h"
|
||||
#include "tic.h"
|
||||
|
||||
|
||||
#include "toberep.h"
|
||||
|
||||
|
||||
@@ -40,35 +38,37 @@
|
||||
* Add a file whos data is in T_File to the toberep.data file.
|
||||
* The newfiles announce option will later remove these records.
|
||||
*/
|
||||
void Add_ToBeRep()
|
||||
int Add_ToBeRep()
|
||||
{
|
||||
char fname[128];
|
||||
struct _filerecord Temp;
|
||||
FILE *tbr;
|
||||
int Found = FALSE;
|
||||
char *fname;
|
||||
struct _filerecord Temp;
|
||||
FILE *tbr;
|
||||
int Found = FALSE;
|
||||
|
||||
sprintf(fname, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
||||
if ((tbr = fopen(fname, "a+")) == NULL) {
|
||||
WriteError("$Can't create %s", fname);
|
||||
return;
|
||||
}
|
||||
fname = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(fname, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
||||
if ((tbr = fopen(fname, "a+")) == NULL) {
|
||||
WriteError("$Can't create %s", fname);
|
||||
free(fname);
|
||||
return FALSE;
|
||||
}
|
||||
free(fname);
|
||||
|
||||
fseek(tbr, 0, SEEK_SET);
|
||||
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
|
||||
if ((strcmp(Temp.Name, T_File.Name) == 0) &&
|
||||
(Temp.Fdate == T_File.Fdate) &&
|
||||
(strcmp(Temp.Echo, T_File.Echo) == 0))
|
||||
Found = TRUE;
|
||||
}
|
||||
fseek(tbr, 0, SEEK_SET);
|
||||
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
|
||||
if ((strcmp(Temp.Name, T_File.Name) == 0) && (Temp.Fdate == T_File.Fdate))
|
||||
Found = TRUE;
|
||||
}
|
||||
|
||||
if (Found) {
|
||||
Syslog('!', "File %s already in toberep.data", T_File.Name);
|
||||
fclose(tbr);
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite(&T_File, sizeof(T_File), 1, tbr);
|
||||
if (Found) {
|
||||
Syslog('!', "File %s already in toberep.data", T_File.Name);
|
||||
fclose(tbr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fwrite(&T_File, sizeof(T_File), 1, tbr);
|
||||
fclose(tbr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
#ifndef _TOBEREP_H
|
||||
#define _TOBEREP_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void Add_ToBeRep(void);
|
||||
|
||||
int Add_ToBeRep(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user