diff --git a/src/ircd.c b/src/ircd.c index 56bbef2f1..085a43653 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -1204,9 +1204,7 @@ int InitUnrealIRCd(int argc, char *argv[]) init_CommandHash(); initwhowas(); initstats(); -#ifndef NOREMOVETMP DeleteTempModules(); -#endif booted = FALSE; #if !defined(_WIN32) && !defined(_AMIGA) && !defined(OSXTIGER) && DEFAULT_PERMISSIONS != 0 /* Hack to stop people from being able to read the config file */ diff --git a/src/modules.c b/src/modules.c index d42aa1fb4..840000595 100644 --- a/src/modules.c +++ b/src/modules.c @@ -69,6 +69,12 @@ void *obsd_dlsym(void *handle, char *symbol) { } #endif +void deletetmp(char *path) +{ +#ifndef NOREMOVETMP + remove(path); +#endif +} void DeleteTempModules(void) { @@ -94,7 +100,7 @@ void DeleteTempModules(void) if (!strstr(fname, ".so") && !strstr(fname, ".conf") && strstr(fname, "core")) continue; /* core dump */ ircsnprintf(tempbuf, sizeof(tempbuf), "%s/%s", TMPDIR, fname); - remove(tempbuf); + deletetmp(tempbuf); } closedir(fd); #else @@ -109,7 +115,7 @@ void DeleteTempModules(void) if (strcmp(hData.cFileName, ".") || strcmp(hData.cFileName, "..")) { ircsnprintf(tempbuf, sizeof(tempbuf), "%s/%s", TMPDIR, hData.cFileName); - remove(tempbuf); + deletetmp(tempbuf); } } while (FindNextFile(hFile, &hData)) @@ -117,7 +123,7 @@ void DeleteTempModules(void) if (!strcmp(hData.cFileName, ".") || !strcmp(hData.cFileName, "..")) continue; ircsnprintf(tempbuf, sizeof(tempbuf), "%s/%s", TMPDIR, hData.cFileName); - remove(tempbuf); + deletetmp(tempbuf); } FindClose(hFile); #endif @@ -241,13 +247,6 @@ static char *validate_mod_header(ModuleHeader *mod_header) return NULL; /* SUCCESS */ } -void deletetmp(char *path) -{ -#ifndef REMOVETMP - remove(path); -#endif -} - /* * Returns an error if insucessful .. yes NULL is OK! */