[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 2/2] Don't fatal_error if required mounts are already mounted



Change loader/init.c so it doesn't bother checking the return value
of mount(). Instead it just checks to see if the mount functions as
expected - for example, after mounting /proc it checks to see if
/proc/cmdline exists.
---
 loader/init.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/loader/init.c b/loader/init.c
index 39bade0..f823acd 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -569,7 +569,8 @@ int main(int argc, char **argv) {
     printf("anaconda installer init version %s starting\n", VERSION);
 
     printf("mounting /proc filesystem... "); 
-    if (mount("/proc", "/proc", "proc", 0, NULL))
+    mount("/proc", "proc", "proc", 0, NULL);
+    if (access("/proc/cmdline", R_OK) == -1)
         fatal_error(1);
     printf("done\n");
 
@@ -590,7 +591,8 @@ int main(int argc, char **argv) {
     }
 
     printf("creating /dev filesystem... "); 
-    if (mount("/dev", "/dev", "tmpfs", 0, NULL))
+    mount("/dev", "/dev", "tmpfs", 0, NULL);
+    if (access("/dev", W_OK) == -1)
         fatal_error(1);
     createDevices();
     printf("done\n");
@@ -628,12 +630,14 @@ int main(int argc, char **argv) {
     printf("done\n");
 
     printf("mounting /dev/pts (unix98 pty) filesystem... "); 
-    if (mount("/dev/pts", "/dev/pts", "devpts", 0, NULL))
+    mount("/dev/pts", "/dev/pts", "devpts", 0, NULL);
+    if (access("/dev/pts/ptmx", F_OK) == -1)
         fatal_error(1);
     printf("done\n");
 
     printf("mounting /sys filesystem... "); 
-    if (mount("/sys", "/sys", "sysfs", 0, NULL))
+    mount("/sys", "/sys", "sysfs", 0, NULL);
+    if (access("/sys/class/block", R_OK) == -1)
         fatal_error(1);
     printf("done\n");
 
@@ -777,7 +781,8 @@ int main(int argc, char **argv) {
     mkdir("/tmp", 0755);
 
     printf("mounting /tmp as tmpfs... ");
-    if (mount("none", "/tmp", "tmpfs", 0, "size=250m"))
+    mount("none", "/tmp", "tmpfs", 0, "size=250m");
+    if (access("/tmp", W_OK) == -1)
         fatal_error(1);
     printf("done\n");
 
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]