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); cmd = xstrcpy(archiver.funarc);
if (strlen(cmd)) { if (strlen(cmd)) {
rc = execute(cmd, Fn, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"); rc = execute(cmd, Fn, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
sync();
if (rc) if (rc)
WriteError("$Magic: unpack in %s, error %d", magic.Path, rc); WriteError("$Magic: unpack in %s, error %d", magic.Path, rc);
else else

View File

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

View File

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

View File

@ -463,6 +463,7 @@ int ProcessTic(fa_list *sbl)
} else { } else {
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName); sprintf(temp1, "%s/%s", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) { if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
UnPacked = TRUE; UnPacked = TRUE;
} else { } else {
chdir(TIC.Inbound); chdir(TIC.Inbound);
@ -548,11 +549,13 @@ int ProcessTic(fa_list *sbl)
sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.RealName); sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null",
(char *)"/dev/null", (char *)"/dev/null") == 0) { (char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
File_Id = TRUE; File_Id = TRUE;
} else { } else {
sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.RealName); sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null",
(char *)"/dev/null", (char *)"/dev/null") == 0) { (char *)"/dev/null", (char *)"/dev/null") == 0) {
sync();
File_Id = TRUE; 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")) { if (execute(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) {
WriteError("$Changing the banner failed"); WriteError("$Changing the banner failed");
} else { } else {
sync();
Syslog('+', "New banner %s", tic.Banner); Syslog('+', "New banner %s", tic.Banner);
TIC.FileSize = file_size(temp1); TIC.FileSize = file_size(temp1);
T_File.Size = TIC.FileSize; 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) { if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) {
sync();
unlink(fn); unlink(fn);
} else { } else {
sync(); sync();
sleep(1); sleep(1);
Syslog('!', "Warning: unpack %s failed, trying again after sync()", fn); 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) { if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) {
sync();
unlink(fn); unlink(fn);
} else { } else {
sync();
strncpy(newname,fn,sizeof(newname)-1); strncpy(newname,fn,sizeof(newname)-1);
strcpy(newname+8,".bad"); strcpy(newname+8,".bad");
rename(fn,newname); rename(fn,newname);