Don't clobber old qwk rep files
This commit is contained in:
parent
64ae6556f1
commit
99feabb6e5
@ -17,14 +17,20 @@ def dostuff(config_file):
|
||||
|
||||
repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP"
|
||||
|
||||
exists = os.path.isfile(repfile)
|
||||
i = 1
|
||||
|
||||
while True:
|
||||
exists = os.path.isfile(repfile)
|
||||
if exists:
|
||||
file = open(repfile, "rb")
|
||||
ftp.storbinary("STOR " + config.get("Main", "Host") + ".REP", file)
|
||||
file.close()
|
||||
os.remove(repfile)
|
||||
print("SENT: " + config.get("Main", "Host") + ".REP")
|
||||
repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP." + i
|
||||
i = i + 1
|
||||
else:
|
||||
break
|
||||
|
||||
qwkfile = config.get("Main", "Inbound") + "/" + config.get("Main", "Host") + ".QWK"
|
||||
with open(qwkfile, 'wb') as file:
|
||||
|
@ -384,6 +384,8 @@ int main(int argc, char **argv) {
|
||||
char buffer[PATH_MAX];
|
||||
char archive[PATH_MAX];
|
||||
int ret;
|
||||
struct stat st;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage:\n ./qwkscan config.ini\n");
|
||||
return -1;
|
||||
@ -412,6 +414,11 @@ int main(int argc, char **argv) {
|
||||
if (qwkidx > 0) {
|
||||
|
||||
snprintf(archive, PATH_MAX, "%s/%s.REP", outbound_path, hostid);
|
||||
i = 1;
|
||||
while (stat(archive, &st) == 0) {
|
||||
snprintf(archive, PATH_MAX, "%s/%s.REP.%d", outbound_path, hostid, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
char *b = buffer;
|
||||
size_t blen = sizeof buffer;
|
||||
|
Reference in New Issue
Block a user