summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-19 17:47:46 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-19 17:47:46 +0000
commit1f9103dce006ddf4b1fa9c5dba9ecf94b54b1358 (patch)
treec4987e224db902c6ab869c77fdfa0c5e81a79915 /mdk-stage1
parent632444023ff45d4c7ce4e15c823c7678574cac79 (diff)
downloaddrakx-1f9103dce006ddf4b1fa9c5dba9ecf94b54b1358.tar
drakx-1f9103dce006ddf4b1fa9c5dba9ecf94b54b1358.tar.gz
drakx-1f9103dce006ddf4b1fa9c5dba9ecf94b54b1358.tar.bz2
drakx-1f9103dce006ddf4b1fa9c5dba9ecf94b54b1358.tar.xz
drakx-1f9103dce006ddf4b1fa9c5dba9ecf94b54b1358.zip
- forgot to close fd when del_loop ioctl fail, busyfied loopback and prevented to umount /home
- better io messages
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/init.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c
index 7411b2b32..16834ce74 100644
--- a/mdk-stage1/init.c
+++ b/mdk-stage1/init.c
@@ -240,16 +240,16 @@ void doklog()
void del_loop(char *device)
{
int fd;
- if ((fd = open(device, O_RDONLY, 0)) < 0) {
- printf("del_loop open failed\n");
+ if ((fd = open(device, O_RDONLY, 0)) < 0)
return;
- }
if (ioctl(fd, LOOP_CLR_FD, 0) < 0) {
- printf("del_loop ioctl failed");
+ close(fd);
return;
}
+ printf("\t%s\n", device);
+
close(fd);
}
@@ -299,7 +299,10 @@ void unmount_filesystems(void)
*p++ = '\0';
while (*p != '\n') p++;
p++;
- if (strcmp(fs[numfs].name, "/") != 0) numfs++; /* skip if root, no need to take initrd root in account */
+ if (strcmp(fs[numfs].name, "/")
+ && strcmp(fs[numfs].name, "/dev")
+ && strncmp(fs[numfs].name, "/proc", 5))
+ numfs++;
}
/* Pixel's ultra-optimized sorting algorithm:
@@ -310,11 +313,11 @@ void unmount_filesystems(void)
for (i = 0; i < numfs; i++) {
/*printf("trying with %s\n", fs[i].name);*/
if (fs[i].mounted && umount(fs[i].name) == 0) {
- if (strncmp(fs[i].dev + sizeof("/dev/") - 1, "loop",
- sizeof("loop") - 1) == 0)
+ printf("\t%s\n", fs[i].name);
+
+ if (strstr(fs[i].dev, "loop"))
del_loop(fs[i].dev);
- printf("\t%s\n", fs[i].name);
fs[i].mounted = 0;
nb++;
}
@@ -436,6 +439,7 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused))
return 0;
sync(); sync();
+ sleep(5);
printf("sending termination signals...");
kill(-1, 15);
@@ -449,9 +453,11 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused))
unmount_filesystems();
+ sync(); sync();
+
if (!abnormal_termination) {
- printf("rebooting system\n");
- sleep(2);
+ printf("rebooting system in 10 seconds\n");
+ sleep(10);
reboot(0xfee1dead, 672274793, 0x01234567);
} else {
printf("you may safely reboot your system\n");