Run bootclean() from bootmisc plugin instead

This patch moves both the definition and the call to bootclean() from
finit.c to the bootmisc plugin.  We want to call bootclean() *after*
any /run and /var file systems have been mounted.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-10-09 23:15:06 +02:00
1 parent 24a0ddfc59
commit a013e48ab5
2 files changed
+28 -28

No files matched your search

-27
View File
@@ -25,7 +25,6 @@
#include "config.h" /* Generated by configure script */
#include <ctype.h>
#include <ftw.h>
#include <glob.h>
#include <dirent.h>
#ifdef HAVE_FSTAB_H
@@ -118,29 +117,6 @@ static int fsck(int pass)
return 0;
}
static int do_clean(const char *fpath, const struct stat *UNUSED(sb), int UNUSED(tflag), struct FTW *ftwbuf)
{
if (ftwbuf->level == 0)
return 1;
(void)remove(fpath);
return 0;
}
static void bootclean(void)
{
char *dir[] = {
"/tmp/",
"/var/run/",
"/var/lock/",
NULL
};
for (int i = 0; dir[i]; i++)
nftw(dir[i], do_clean, 20, FTW_DEPTH);
}
static void networking(void)
{
size_t i;
@@ -401,9 +377,6 @@ int main(int argc, char* argv[])
run("/sbin/swapon -ea");
umask(0022);
/* Cleanup of stale files, if any still linger on. */
bootclean();
/* Base FS up, enable standard SysV init signals */
sig_setup(&loop);