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

[Libguestfs] [PATCH 4/4] febootstrap/helper/init: Mount /proc if not already present.



---
 helper/init.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/helper/init.c b/helper/init.c
index 40f0e43..a7f55cd 100644
--- a/helper/init.c
+++ b/helper/init.c
@@ -56,6 +56,17 @@ static char line[1024];
 int
 main ()
 {
+  struct stat s;
+  if ( (stat ("/proc/uptime", &s) == -1) && (errno == ENOENT) ) {
+    mkdir("/proc", 0755);
+    if (verbose)
+      fprintf (stderr, "febootstrap: mounting /proc\n");
+    if (mount ("proc", "/proc", "proc", 0, "") == -1) {
+      perror ("mount: /proc");
+      exit (EXIT_FAILURE);
+    }
+  }
+
   print_uptime ();
   fprintf (stderr, "febootstrap: ext2 mini initrd starting up\n");
 
-- 
1.7.5.3


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