Small bugfixes
This commit is contained in:
parent
cb009e6372
commit
39dbfe3daa
@ -10,6 +10,7 @@ v0.39.5 24-Dec-2003
|
|||||||
common.a:
|
common.a:
|
||||||
Allows node locking with zero bytes lockfiles created by some
|
Allows node locking with zero bytes lockfiles created by some
|
||||||
other OS when enabled in the setup.
|
other OS when enabled in the setup.
|
||||||
|
The attach function now checks if a file is already attached.
|
||||||
|
|
||||||
mbcico:
|
mbcico:
|
||||||
Binkp code cleanup.
|
Binkp code cleanup.
|
||||||
|
39
lib/attach.c
39
lib/attach.c
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Attach files to outbound
|
* Purpose ...............: Attach files to outbound
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2004
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -41,7 +41,7 @@
|
|||||||
int attach(faddr noden, char *ofile, int mode, char flavor)
|
int attach(faddr noden, char *ofile, int mode, char flavor)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *flofile;
|
char *flofile, *thefile;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (ofile == NULL)
|
if (ofile == NULL)
|
||||||
@ -53,6 +53,7 @@ int attach(faddr noden, char *ofile, int mode, char flavor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
flofile = calloc(PATH_MAX, sizeof(char));
|
flofile = calloc(PATH_MAX, sizeof(char));
|
||||||
|
thefile = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(flofile, "%s", floname(&noden, flavor));
|
sprintf(flofile, "%s", floname(&noden, flavor));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -74,6 +75,7 @@ int attach(faddr noden, char *ofile, int mode, char flavor)
|
|||||||
WriteError("$Can't open %s", flofile);
|
WriteError("$Can't open %s", flofile);
|
||||||
WriteError("May be locked by mbcico");
|
WriteError("May be locked by mbcico");
|
||||||
free(flofile);
|
free(flofile);
|
||||||
|
free(thefile);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,39 +83,54 @@ int attach(faddr noden, char *ofile, int mode, char flavor)
|
|||||||
case LEAVE:
|
case LEAVE:
|
||||||
if (strlen(CFG.dospath)) {
|
if (strlen(CFG.dospath)) {
|
||||||
if (CFG.leavecase)
|
if (CFG.leavecase)
|
||||||
fprintf(fp, "%s\r\n", Unix2Dos(ofile));
|
sprintf(thefile, "%s", Unix2Dos(ofile));
|
||||||
else
|
else
|
||||||
fprintf(fp, "%s\r\n", tu(Unix2Dos(ofile)));
|
sprintf(thefile, "%s", tu(Unix2Dos(ofile)));
|
||||||
} else {
|
} else {
|
||||||
fprintf(fp, "%s\r\n", ofile);
|
sprintf(thefile, "%s", ofile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KFS:
|
case KFS:
|
||||||
if (strlen(CFG.dospath)) {
|
if (strlen(CFG.dospath)) {
|
||||||
if (CFG.leavecase)
|
if (CFG.leavecase)
|
||||||
fprintf(fp, "^%s\r\n", Unix2Dos(ofile));
|
sprintf(thefile, "^%s", Unix2Dos(ofile));
|
||||||
else
|
else
|
||||||
fprintf(fp, "^%s\r\n", tu(Unix2Dos(ofile)));
|
sprintf(thefile, "^%s", tu(Unix2Dos(ofile)));
|
||||||
} else {
|
} else {
|
||||||
fprintf(fp, "^%s\r\n", ofile);
|
sprintf(thefile, "^%s", ofile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TFS:
|
case TFS:
|
||||||
if (strlen(CFG.dospath)) {
|
if (strlen(CFG.dospath)) {
|
||||||
if (CFG.leavecase)
|
if (CFG.leavecase)
|
||||||
fprintf(fp, "#%s\r\n", Unix2Dos(ofile));
|
sprintf(thefile, "#%s", Unix2Dos(ofile));
|
||||||
else
|
else
|
||||||
fprintf(fp, "#%s\r\n", tu(Unix2Dos(ofile)));
|
sprintf(thefile, "#%s", tu(Unix2Dos(ofile)));
|
||||||
} else {
|
} else {
|
||||||
fprintf(fp, "#%s\r\n", ofile);
|
sprintf(thefile, "#%s", ofile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
while (fgets(flofile, PATH_MAX -1, fp) != NULL) {
|
||||||
|
Striplf(flofile);
|
||||||
|
if (strncmp(flofile, thefile, strlen(thefile)) == 0) {
|
||||||
|
fclose(fp);
|
||||||
|
Syslog('+', "attach: file %s already attached", ofile);
|
||||||
|
free(flofile);
|
||||||
|
free(thefile);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fseek(fp, 0, SEEK_END);
|
||||||
|
fprintf(fp, "%s\r\n", thefile);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(flofile);
|
free(flofile);
|
||||||
|
free(thefile);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,8 +814,9 @@ SM_RETURN
|
|||||||
*/
|
*/
|
||||||
int file_transfer(void)
|
int file_transfer(void)
|
||||||
{
|
{
|
||||||
int rc = 0, complete = FALSE;
|
int rc = 0, complete = FALSE;
|
||||||
TrType Trc = Ok;
|
TrType Trc = Ok;
|
||||||
|
binkp_list *tmp;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]);
|
Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]);
|
||||||
@ -894,7 +895,23 @@ int file_transfer(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeinitTransfer:/* Clear current filelist */
|
case DeinitTransfer:/*
|
||||||
|
* In case of a transfer error the filelist is not yet cleared
|
||||||
|
*/
|
||||||
|
if (tosend != NULL) {
|
||||||
|
Syslog('b', "Clear current filelist");
|
||||||
|
for (tmp = bll; bll; bll = tmp) {
|
||||||
|
tmp = bll->next;
|
||||||
|
if (bll->local)
|
||||||
|
free(bll->local);
|
||||||
|
if (bll->remote)
|
||||||
|
free(bll->remote);
|
||||||
|
free(bll);
|
||||||
|
}
|
||||||
|
|
||||||
|
tidy_filelist(tosend, TRUE);
|
||||||
|
tosend = NULL;
|
||||||
|
}
|
||||||
if (bp.rc)
|
if (bp.rc)
|
||||||
return MBERR_FTRANSFER;
|
return MBERR_FTRANSFER;
|
||||||
else
|
else
|
||||||
@ -1354,23 +1371,6 @@ TrType binkp_transmitter(void)
|
|||||||
if (tosend != NULL) {
|
if (tosend != NULL) {
|
||||||
Syslog('b', "Clear current filelist");
|
Syslog('b', "Clear current filelist");
|
||||||
|
|
||||||
debug_binkp_list(&bll);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Process all send files.
|
|
||||||
*/
|
|
||||||
for (tsl = tosend; tsl; tsl = tsl->next) {
|
|
||||||
if (tsl->remote == NULL) {
|
|
||||||
execute_disposition(tsl);
|
|
||||||
} else {
|
|
||||||
for (tmp = bll; tmp; tmp = tmp->next) {
|
|
||||||
if ((strcmp(tmp->local, tsl->local) == 0) && (tmp->state == Got)) {
|
|
||||||
execute_disposition(tsl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (tmp = bll; bll; bll = tmp) {
|
for (tmp = bll; bll; bll = tmp) {
|
||||||
tmp = bll->next;
|
tmp = bll->next;
|
||||||
if (bll->local)
|
if (bll->local)
|
||||||
@ -1749,6 +1749,7 @@ int binkp_process_messages(void)
|
|||||||
{
|
{
|
||||||
the_queue *tmpq, *oldq;
|
the_queue *tmpq, *oldq;
|
||||||
binkp_list *tmp;
|
binkp_list *tmp;
|
||||||
|
file_list *tsl;
|
||||||
int Found;
|
int Found;
|
||||||
char *lname;
|
char *lname;
|
||||||
time_t ltime;
|
time_t ltime;
|
||||||
@ -1828,6 +1829,15 @@ int binkp_process_messages(void)
|
|||||||
Syslog('+', "Binkp: remote GOT \"%s\"", tmp->remote);
|
Syslog('+', "Binkp: remote GOT \"%s\"", tmp->remote);
|
||||||
}
|
}
|
||||||
tmp->state = Got;
|
tmp->state = Got;
|
||||||
|
for (tsl = tosend; tsl; tsl = tsl->next) {
|
||||||
|
if (tsl->remote == NULL) {
|
||||||
|
execute_disposition(tsl);
|
||||||
|
} else {
|
||||||
|
if (strcmp(tmp->local, tsl->local) == 0) {
|
||||||
|
execute_disposition(tsl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1854,7 +1864,7 @@ int binkp_process_messages(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Found) {
|
if (!Found) {
|
||||||
Syslog('!', "Binkp: unexpected M_GOT \"%s\"", tmpq->data); /* Ignore frame */
|
Syslog('!', "Binkp: unexpected M_SKIP \"%s\"", tmpq->data); /* Ignore frame */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Illegal message on the queue */
|
/* Illegal message on the queue */
|
||||||
|
Reference in New Issue
Block a user