diff options
author | NeilBrown <neilb@suse.de> | 2014-01-20 23:43:31 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-01-20 23:43:31 +0100 |
commit | 5e57245e3feba65385fc100e0f2c3d1214d79915 (patch) | |
tree | a6a18abd8560900a3a31229447038f5ec649b8cb /mdmon.c | |
parent | IMSM: don't crash when creating an array with missing devices. (diff) | |
download | mdadm-5e57245e3feba65385fc100e0f2c3d1214d79915.tar.xz mdadm-5e57245e3feba65385fc100e0f2c3d1214d79915.zip |
mdmon: don't complain about notifying parent when there is no need
When run with --foreground mdmon has no need to notify any
parent, so it shouldn't even try, let alone complain when it fails.
Also close an end of a pipe which is no longer used.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdmon.c')
-rw-r--r-- | mdmon.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -429,6 +429,7 @@ static int mdmon(char *devnm, int must_fork, int takeover) wait(&status); status = WEXITSTATUS(status); } + close(pfd[0]); return status; } } else @@ -516,10 +517,12 @@ static int mdmon(char *devnm, int must_fork, int takeover) container->sock = make_control_sock(devnm); status = 0; - if (write(pfd[1], &status, sizeof(status)) < 0) - pr_err("failed to notify our parent: %d\n", - getppid()); - close(pfd[1]); + if (pfd[1] >= 0) { + if (write(pfd[1], &status, sizeof(status)) < 0) + pr_err("failed to notify our parent: %d\n", + getppid()); + close(pfd[1]); + } mlockall(MCL_CURRENT | MCL_FUTURE); |