diff --git a/ChangeLog b/ChangeLog index 0b6301fc..9499036e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ $Id$ v0.83.3 03-Dec-2005 + libmbse.a: + Fixed new tmpwork functions. + + mbfido: + Fixed creation of tmpwork directory. + + v0.83.2 16-Nov-2005 - 03-Dec-2005 libmbse.a: diff --git a/lib/tmpwork.c b/lib/tmpwork.c index 6de7da87..d6abc9c0 100644 --- a/lib/tmpwork.c +++ b/lib/tmpwork.c @@ -45,11 +45,11 @@ void clean_tmpwork(void) arc = calloc(PATH_MAX, sizeof(char)); getcwd(buf, PATH_MAX); snprintf(temp, PATH_MAX, "%s/tmp", getenv("MBSE_ROOT")); - snprintf(arc, PATH_MAX, "arc%d", (int)getpid()); + snprintf(arc, PATH_MAX, "-r -f arc%d", (int)getpid()); if (chdir(temp) == 0) { - Syslog('f', "clean_tmpwork %s/%s", temp, arc); - execute_pth((char *)"rm -r -f", arc, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"); + Syslog('f', "clean_tmpwork %s/arc%d", temp, (int)getpid()); + execute_pth((char *)"rm", arc, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"); } else { WriteError("$Can't chdir to %s", temp); } @@ -70,8 +70,7 @@ int create_tmpwork(void) if (! is_tmpwork) { temp = calloc(PATH_MAX, sizeof(char)); - getcwd(buf, PATH_MAX); - snprintf(temp, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid()); + snprintf(temp, PATH_MAX, "%s/tmp/arc%d/foobar", getenv("MBSE_ROOT"), (int)getpid()); if (! mkdirs(temp, 0755)) rc = 1; diff --git a/mbfido/ptic.c b/mbfido/ptic.c index d9d68312..c9601594 100644 --- a/mbfido/ptic.c +++ b/mbfido/ptic.c @@ -340,6 +340,15 @@ int ProcessTic(fa_list **sbl, orphans **opl) * is used for this file. */ if (strlen(tic.Convert) || tic.VirScan || tic.FileId || tic.ConvertAll || strlen(tic.Banner)) { + /* + * Create tmp workdir + */ + if (create_tmpwork()) { + free(Temp); + tidy_qualify(&qal); + return 1; + } + if ((unarc = unpacker(TIC.TicIn.File)) == NULL) Syslog('+', "Unknown archive format %s", TIC.TicIn.File); else { @@ -366,15 +375,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) if ((tic.VirScan || MustRearc) && IsArchive) { - /* - * Create a temp directory for the archive conversion. - */ snprintf(temp2, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid()); - if (create_tmpwork) { - free(Temp); - tidy_qualify(&qal); - return 1; - } /* * Check for stale FILE_ID.DIZ files @@ -396,6 +397,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) Bad((char *)"Not enough free diskspace left"); free(Temp); tidy_qualify(&qal); + clean_tmpwork(); return 1; } @@ -403,6 +405,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) WriteError("$Can't change to %s", temp2); free(Temp); tidy_qualify(&qal); + clean_tmpwork(); return 1; } @@ -411,6 +414,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) chdir(TIC.Inbound); free(Temp); tidy_qualify(&qal); + clean_tmpwork(); return 1; } @@ -446,6 +450,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc)); free(Temp); tidy_qualify(&qal); + clean_tmpwork(); return 1; } @@ -454,6 +459,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) WriteError("$Can't change to %s", temp2); free(Temp); tidy_qualify(&qal); + clean_tmpwork(); return 1; } } @@ -471,6 +477,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) Bad((char *)"Possible virus found!"); free(Temp); tidy_qualify(&qal); + clean_tmpwork(); return 1; } @@ -662,6 +669,7 @@ int ProcessTic(fa_list **sbl, orphans **opl) Bad((char *)"File Import Error"); free(Temp); tidy_qualify(&qal); + clean_tmpwork(); return 1; } }