Second attempt unzip mail archives patch
This commit is contained in:
parent
6e31daa907
commit
509b9bbc2b
@ -4610,6 +4610,9 @@ v0.33.20 10-Feb-2002
|
|||||||
from a uplink which has a echomail taglist in one of the
|
from a uplink which has a echomail taglist in one of the
|
||||||
mailgroups defined. The area is created with the defaults
|
mailgroups defined. The area is created with the defaults
|
||||||
from the mailgroup.
|
from the mailgroup.
|
||||||
|
If mbfido fails to unzip a incoming mailarchive, a second
|
||||||
|
attempt is done after a sync() and one second delay. This
|
||||||
|
seems to be a kernel flush problem.
|
||||||
|
|
||||||
mball:
|
mball:
|
||||||
Will not crash anymore when it needs more then 10 minutes to
|
Will not crash anymore when it needs more then 10 minutes to
|
||||||
|
@ -139,43 +139,49 @@ int checkspace(char *dir, char *fn, int factor)
|
|||||||
*/
|
*/
|
||||||
int unpack(char *fn)
|
int unpack(char *fn)
|
||||||
{
|
{
|
||||||
char newname[16];
|
char newname[16];
|
||||||
char *cmd = NULL, *unarc;
|
char *cmd = NULL, *unarc;
|
||||||
int rc = 0, ld;
|
int rc = 0, ld;
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
colour(11, 0);
|
colour(11, 0);
|
||||||
printf("Unpacking file %s\n", fn);
|
printf("Unpacking file %s\n", fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((unarc = unpacker(fn)) == NULL)
|
if ((unarc = unpacker(fn)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!getarchiver(unarc))
|
if (!getarchiver(unarc))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
cmd = xstrcpy(archiver.munarc);
|
cmd = xstrcpy(archiver.munarc);
|
||||||
|
|
||||||
if ((cmd == NULL) || (cmd == ""))
|
if ((cmd == NULL) || (cmd == ""))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((ld = f_lock(fn)) == -1) {
|
|
||||||
free(cmd);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null");
|
|
||||||
if (rc == 0)
|
|
||||||
unlink(fn);
|
|
||||||
else {
|
|
||||||
strncpy(newname,fn,sizeof(newname)-1);
|
|
||||||
strcpy(newname+8,".bad");
|
|
||||||
rename(fn,newname);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ((ld = f_lock(fn)) == -1) {
|
||||||
free(cmd);
|
free(cmd);
|
||||||
funlock(ld);
|
return 1;
|
||||||
return rc;
|
}
|
||||||
|
|
||||||
|
if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) {
|
||||||
|
unlink(fn);
|
||||||
|
} else {
|
||||||
|
sync();
|
||||||
|
sleep(1);
|
||||||
|
Syslog('!', "Warning: unpack %s failed, trying again after sync()");
|
||||||
|
if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) {
|
||||||
|
unlink(fn);
|
||||||
|
} else {
|
||||||
|
strncpy(newname,fn,sizeof(newname)-1);
|
||||||
|
strcpy(newname+8,".bad");
|
||||||
|
rename(fn,newname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(cmd);
|
||||||
|
funlock(ld);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user