Added some extra sync() commands

This commit is contained in:
Michiel Broek 2002-03-27 20:35:19 +00:00
parent dfa2baebd3
commit 3c710250fa
5 changed files with 12 additions and 0 deletions

View File

@ -313,6 +313,7 @@ void Magic_UnpackFile(void)
cmd = xstrcpy(archiver.funarc);
if (strlen(cmd)) {
rc = execute(cmd, Fn, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
sync();
if (rc)
WriteError("$Magic: unpack in %s, error %d", magic.Path, rc);
else

View File

@ -306,6 +306,7 @@ int main(int argc, char **argv)
die(100);
}
free(cmd);
sync();
Match = FALSE;
if ((dp = opendir(wrk)) != NULL) {
@ -416,6 +417,7 @@ int main(int argc, char **argv)
else {
CreateSema((char *)"mailin");
}
sync();
free(p);
free(cmd);
}

View File

@ -287,12 +287,14 @@ int UnpackFile(char *File)
free(temp);
free(pwd);
free(cmd);
sync();
return TRUE;
} else {
chdir(pwd);
WriteError("Unpack error, file may be corrupt");
DeleteVirusWork();
}
sync();
return FALSE;
}

View File

@ -463,6 +463,7 @@ int ProcessTic(fa_list *sbl)
} else {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
UnPacked = TRUE;
} else {
chdir(TIC.Inbound);
@ -548,11 +549,13 @@ int ProcessTic(fa_list *sbl)
sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null",
(char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
File_Id = TRUE;
} else {
sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null",
(char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
File_Id = TRUE;
}
}
@ -640,6 +643,7 @@ int ProcessTic(fa_list *sbl)
if (execute(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) {
WriteError("$Changing the banner failed");
} else {
sync();
Syslog('+', "New banner %s", tic.Banner);
TIC.FileSize = file_size(temp1);
T_File.Size = TIC.FileSize;

View File

@ -165,14 +165,17 @@ int unpack(char *fn)
}
if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) {
sync();
unlink(fn);
} else {
sync();
sleep(1);
Syslog('!', "Warning: unpack %s failed, trying again after sync()", fn);
if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) {
sync();
unlink(fn);
} else {
sync();
strncpy(newname,fn,sizeof(newname)-1);
strcpy(newname+8,".bad");
rename(fn,newname);