Fork before cleaning up the old filesystem, so it becomes asyncronous,
which results in a faster boot time.
Signed-off-by: Peter Jones <pjones@redhat.com>
const char *umounts[] = { "/dev", "/proc", "/sys", NULL };
int i;
int cfd;
+ pid_t pid;
for (i = 0; umounts[i] != NULL; i++) {
char newmount[PATH_MAX];
cfd = open("/", O_RDONLY);
if (cfd >= 0) {
- recursiveRemove(cfd);
+ pid = fork();
+ if (pid <= 0) {
+ recursiveRemove(cfd);
+ if (pid == 0)
+ exit(EXIT_SUCCESS);
+ }
close(cfd);
}