Fix for unzip prompting to overwrite a file and hanging bbs

This commit is contained in:
Andrew Pamment 2016-12-06 21:46:08 +10:00
parent 377068f439
commit 091ec83909
2 changed files with 16 additions and 10 deletions

View File

@ -43,7 +43,7 @@ tWORD converts(tWORD s) {
} }
int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file, FILE *mix_file, FILE *dat_file) { int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file, FILE *mix_file, FILE *dat_file, int *last_ptr) {
struct msg_headers *msghs = read_message_headers(confr, area, gUser); struct msg_headers *msghs = read_message_headers(confr, area, gUser);
int all_unread = 1; int all_unread = 1;
s_JamBase *jb; s_JamBase *jb;
@ -117,9 +117,10 @@ int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file
fti.msgnum = converts((tWORD)msghs->msgs[k]->msg_h->MsgNum); fti.msgnum = converts((tWORD)msghs->msgs[k]->msg_h->MsgNum);
fti.replyto = 0; fti.replyto = 0;
fti.replyat = 0; fti.replyat = 0;
fti.msgptr = convertl(ftell(dat_file)); fti.msgptr = convertl(*last_ptr);
fti.msglength = convertl(msghs->msgs[k]->msg_h->TxtLen); fti.msglength = convertl(msghs->msgs[k]->msg_h->TxtLen);
*last_ptr += msghs->msgs[k]->msg_h->TxtLen;
if (msghs->msgs[k]->msg_h->Attribute & MSG_LOCAL) { if (msghs->msgs[k]->msg_h->Attribute & MSG_LOCAL) {
fti.flags |= FTI_MSGLOCAL; fti.flags |= FTI_MSGLOCAL;
@ -183,6 +184,7 @@ void bwave_create_packet() {
tWORD flags; tWORD flags;
int lasttot; int lasttot;
int bpos; int bpos;
int last_ptr = 0;
struct termios oldit; struct termios oldit;
struct termios oldot; struct termios oldot;
@ -219,13 +221,13 @@ void bwave_create_packet() {
snprintf(buffer, 1024, "%s/node%d/%s.FTI", conf.bbs_path, mynode, conf.bwave_name); snprintf(buffer, 1024, "%s/node%d/%s.FTI", conf.bbs_path, mynode, conf.bwave_name);
fti_file = fopen(buffer, "w"); fti_file = fopen(buffer, "wb");
snprintf(buffer, 1024, "%s/node%d/%s.MIX", conf.bbs_path, mynode, conf.bwave_name); snprintf(buffer, 1024, "%s/node%d/%s.MIX", conf.bbs_path, mynode, conf.bwave_name);
mix_file = fopen(buffer, "w"); mix_file = fopen(buffer, "wb");
snprintf(buffer, 1024, "%s/node%d/%s.DAT", conf.bbs_path, mynode, conf.bwave_name); snprintf(buffer, 1024, "%s/node%d/%s.DAT", conf.bbs_path, mynode, conf.bwave_name);
dat_file = fopen(buffer, "w"); dat_file = fopen(buffer, "wb");
s_printf("\r\n"); s_printf("\r\n");
@ -233,7 +235,7 @@ void bwave_create_packet() {
for (j=0;j<conf.mail_conferences[i]->mail_area_count;j++) { for (j=0;j<conf.mail_conferences[i]->mail_area_count;j++) {
if (conf.mail_conferences[i]->mail_areas[j]->read_sec_level <= gUser->sec_level && conf.mail_conferences[i]->mail_areas[j]->qwkname != NULL) { if (conf.mail_conferences[i]->mail_areas[j]->read_sec_level <= gUser->sec_level && conf.mail_conferences[i]->mail_areas[j]->qwkname != NULL) {
lasttot = totmsgs; lasttot = totmsgs;
totmsgs = bwave_scan_area(i, j, area_count+1, totmsgs, fti_file, mix_file, dat_file); totmsgs = bwave_scan_area(i, j, area_count+1, totmsgs, fti_file, mix_file, dat_file, &last_ptr);
s_printf(get_string(195), conf.mail_conferences[i]->name, conf.mail_conferences[i]->mail_areas[j]->name, totmsgs - lasttot); s_printf(get_string(195), conf.mail_conferences[i]->name, conf.mail_conferences[i]->mail_areas[j]->name, totmsgs - lasttot);
if (lasttot == totmsgs) { if (lasttot == totmsgs) {
continue; continue;
@ -297,7 +299,7 @@ void bwave_create_packet() {
snprintf(buffer, 1024, "%s/node%d/%s.INF", conf.bbs_path, mynode, conf.bwave_name); snprintf(buffer, 1024, "%s/node%d/%s.INF", conf.bbs_path, mynode, conf.bwave_name);
inf_file = fopen(buffer, "w"); inf_file = fopen(buffer, "wb");
fwrite(&hdr, sizeof(INF_HEADER), 1, inf_file); fwrite(&hdr, sizeof(INF_HEADER), 1, inf_file);
for (i=0;i<area_count;i++) { for (i=0;i<area_count;i++) {
@ -721,6 +723,10 @@ void bwave_upload_reply() {
fclose(upl_file); fclose(upl_file);
unlink(buffer); unlink(buffer);
snprintf(buffer, 1024, "%s/node%d/%s.OLC", conf.bbs_path, mynode, conf.bwave_name);
unlink(buffer);
snprintf(buffer, 1024, "%s/node%d/%s.REQ", conf.bbs_path, mynode, conf.bwave_name);
unlink(buffer);
s_printf("\r\n"); s_printf("\r\n");
s_printf(get_string(6)); s_printf(get_string(6));

View File

@ -22,7 +22,7 @@ Main AKA = 1:2/3.4
QWK Name = MAGICKA QWK Name = MAGICKA
QWK Max Messages = 5000; QWK Max Messages = 5000;
ZIP Command = zip -j *a *f ZIP Command = zip -j *a *f
UNZIP Command = unzip -j *a -d *d UNZIP Command = unzip -j -o *a -d *d
[paths] [paths]
WWW Path = /home/andrew/MagickaBBS/www WWW Path = /home/andrew/MagickaBBS/www