summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_mount.c
diff options
context:
space:
mode:
authorKarel Zak2011-12-02 18:20:34 +0100
committerKarel Zak2011-12-02 18:20:34 +0100
commitd2c97887fee6cdb44378190b04c3dd6d059d3fad (patch)
tree3ed9b30ac6edb49f4fe771de526b0b7c6fac1ccc /libmount/src/context_mount.c
parentlibmount: add "+" prefix for options pattern (e.g findmnt -O) (diff)
downloadkernel-qcow2-util-linux-d2c97887fee6cdb44378190b04c3dd6d059d3fad.tar.gz
kernel-qcow2-util-linux-d2c97887fee6cdb44378190b04c3dd6d059d3fad.tar.xz
kernel-qcow2-util-linux-d2c97887fee6cdb44378190b04c3dd6d059d3fad.zip
libmount: add support for mount -a --fork
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_mount.c')
-rw-r--r--libmount/src/context_mount.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index 7b4c0bae3..8fba9c6be 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -762,12 +762,30 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
return 0;
}
+ if (mnt_context_is_fork(cxt)) {
+ rc = mnt_fork_context(cxt);
+ if (rc)
+ return rc; /* fork error */
+
+ if (mnt_context_is_parent(cxt)) {
+ return 0; /* parent */
+ }
+ }
+
+ /* child or non-forked */
+
rc = mnt_context_set_fs(cxt, *fs);
- if (rc)
- return rc;
- rc = mnt_context_mount(cxt);
- if (mntrc)
- *mntrc = rc;
+ if (!rc) {
+ rc = mnt_context_mount(cxt);
+ if (mntrc)
+ *mntrc = rc;
+ }
+
+ if (mnt_context_is_child(cxt)) {
+ DBG(CXT, mnt_debug_h(cxt, "next-mount: child exit [rc=%d]", rc));
+ DBG_FLUSH;
+ exit(rc);
+ }
return 0;
}