summaryrefslogtreecommitdiff
path: root/bind-mount.c
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2016-08-12 12:15:28 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2016-08-12 12:26:46 +0200
commite4188b1d2423d62d60838b82fadc1e4dceb5f5a1 (patch)
tree56be13a8b44acf558a8a0d8abc7655234c251334 /bind-mount.c
parent95a2ded375f736ab96afc08785b0ab29f9a188ed (diff)
downloadbubblewrap-e4188b1d2423d62d60838b82fadc1e4dceb5f5a1.tar.gz
Add --remount-ro DEST
This allows to remount a mount point as read only. It will allow us, by remounting / after other mount points are created, to handle a readonly rootfs as specified in the OCI specs: https://github.com/opencontainers/runtime-spec/blob/master/config.md#root-configuration Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'bind-mount.c')
-rw-r--r--bind-mount.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bind-mount.c b/bind-mount.c
index 72fd3c5..d5c45b8 100644
--- a/bind-mount.c
+++ b/bind-mount.c
@@ -244,8 +244,11 @@ bind_mount (int proc_fd,
unsigned long current_flags, new_flags;
int i;
- if (mount (src, dest, NULL, MS_MGC_VAL | MS_BIND | (recursive ? MS_REC : 0), NULL) != 0)
- return 1;
+ if (src)
+ {
+ if (mount (src, dest, NULL, MS_MGC_VAL | MS_BIND | (recursive ? MS_REC : 0), NULL) != 0)
+ return 1;
+ }
current_flags = get_mountflags (proc_fd, dest);