/* Forward referenced functions */
void terminate_stored(int sig);
static int check_resources();
+static void cleanup_old_files();
extern "C" void *device_initialization(void *arg);
drop(uid, gid);
+ cleanup_old_files();
+
+
/* Ensure that Volume Session Time and Id are both
* set and are both non-zero.
*/
return OK;
}
+static void cleanup_old_files()
+{
+ POOLMEM *cleanup = get_pool_memory(PM_MESSAGE);
+ int len = strlen(me->working_directory);
+ pm_strcpy(cleanup, "/bin/rm -f ");
+ pm_strcat(cleanup, me->working_directory);
+ if (len > 0 && me->working_directory[len-1] != '/') {
+ pm_strcat(cleanup, "/");
+ }
+ pm_strcat(cleanup, my_name);
+ pm_strcat(cleanup, "*.spool");
+ run_program(cleanup, 0, NULL);
+ free_pool_memory(cleanup);
+}
+
+
/*
* Here we attempt to init and open each device. This is done
* once at startup in a separate thread.