From 3c710250fa95108db876f3cd497fd890ba32e4f9 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Wed, 27 Mar 2002 20:35:19 +0000 Subject: [PATCH] Added some extra sync() commands --- mbfido/magic.c | 1 + mbfido/mbdiff.c | 2 ++ mbfido/mbfutil.c | 2 ++ mbfido/ptic.c | 4 ++++ mbfido/ulock.c | 3 +++ 5 files changed, 12 insertions(+) diff --git a/mbfido/magic.c b/mbfido/magic.c index 98672bea..56fc1f6f 100644 --- a/mbfido/magic.c +++ b/mbfido/magic.c @@ -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 diff --git a/mbfido/mbdiff.c b/mbfido/mbdiff.c index cb0bc633..909c75ae 100644 --- a/mbfido/mbdiff.c +++ b/mbfido/mbdiff.c @@ -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); } diff --git a/mbfido/mbfutil.c b/mbfido/mbfutil.c index a3d8635c..92365da2 100644 --- a/mbfido/mbfutil.c +++ b/mbfido/mbfutil.c @@ -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; } diff --git a/mbfido/ptic.c b/mbfido/ptic.c index 1f5ea925..a96d094c 100644 --- a/mbfido/ptic.c +++ b/mbfido/ptic.c @@ -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; diff --git a/mbfido/ulock.c b/mbfido/ulock.c index cad3d4ec..491fd208 100644 --- a/mbfido/ulock.c +++ b/mbfido/ulock.c @@ -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);