make it optional to remount the tmpfs as ro
authorJohn Crispin <blogic@openwrt.org>
Fri, 27 Mar 2015 01:27:16 +0000 (02:27 +0100)
committerJohn Crispin <blogic@openwrt.org>
Fri, 27 Mar 2015 01:27:16 +0000 (02:27 +0100)
Signed-off-by: John Crispin <blogic@openwrt.org>
jail/jail.c

index 08d5ee157430a23d87f02332d8f170f930d0add4..3b5587a9ddf77f88f5683a68e1f6196b9eeb2977 100644 (file)
@@ -43,7 +43,7 @@
 #include <libubox/uloop.h>
 
 #define STACK_SIZE     (1024 * 1024)
-#define OPT_ARGS       "P:S:n:r:w:psuld"
+#define OPT_ARGS       "P:S:n:r:w:psuldo"
 
 struct extra {
        struct list_head list;
@@ -289,6 +289,7 @@ static int spawn_child(void *arg)
        char **argv = arg;
        int argc = 0, ch;
        char *mpoint;
+       int ronly = 0;
 
        while (argv[argc])
                argc++;
@@ -305,6 +306,9 @@ static int spawn_child(void *arg)
                case 'p':
                        procfs = 1;
                        break;
+               case 'o':
+                       ronly = 1;
+                       break;
                case 's':
                        sysfs = 1;
                        break;
@@ -331,7 +335,8 @@ static int spawn_child(void *arg)
                mkdir("/sys", 0755);
                mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
        }
-       mount(NULL, "/", NULL, MS_RDONLY | MS_REMOUNT, 0);
+       if (ronly)
+               mount(NULL, "/", NULL, MS_RDONLY | MS_REMOUNT, 0);
 
        uloop_init();