summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2012-01-25 15:18:04 +0100
committerNeilBrown <neilb@suse.de>2012-01-30 02:11:29 +0100
commita0963a86e12a55d501f421048bd7c09cf4d78b93 (patch)
tree6765c15881d7fb365b46c03c83f69bf2411208f9 /util.c
parentAdd --offroot argument to mdmon (diff)
downloadmdadm-a0963a86e12a55d501f421048bd7c09cf4d78b93.tar.xz
mdadm-a0963a86e12a55d501f421048bd7c09cf4d78b93.zip
Spawn mdmon with --offroot if mdadm was launched with --offroot
Acked-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'util.c')
-rw-r--r--util.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/util.c b/util.c
index 6985a707..4ba44e61 100644
--- a/util.c
+++ b/util.c
@@ -32,6 +32,8 @@
#include <dirent.h>
#include <signal.h>
+int __offroot;
+
/*
* following taken from linux/blkpg.h because they aren't
* anywhere else and it isn't safe to #include linux/ * stuff.
@@ -1622,10 +1624,17 @@ int start_mdmon(int devnum)
skipped = 0;
for (i=0; paths[i]; i++)
- if (paths[i][0])
- execl(paths[i], "mdmon",
- devnum2devname(devnum),
- NULL);
+ if (paths[i][0]) {
+ if (__offroot) {
+ execl(paths[i], "mdmon", "--offroot",
+ devnum2devname(devnum),
+ NULL);
+ } else {
+ execl(paths[i], "mdmon",
+ devnum2devname(devnum),
+ NULL);
+ }
+ }
exit(1);
case -1: fprintf(stderr, Name ": cannot run mdmon. "
"Array remains readonly\n");