diff options
author | NeilBrown <neilb@suse.de> | 2008-07-18 16:37:20 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-07-18 16:37:20 +1000 |
commit | 9fe32043178f221526b6d59f3bbce58f777089da (patch) | |
tree | 6dc16f33e5fefbd801484f51ef0605af5d22eefb /util.c | |
parent | 8dfb8619f928d58ac7369c42e9f94dd0dabfed4b (diff) |
mdmon: fork and run as a daemon.
start_mdmon now waits for mdmon to complete initialisation and,
importantly, listen on the socket, before continuing.
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -31,6 +31,7 @@ #include "md_p.h" #include <sys/socket.h> #include <sys/utsname.h> +#include <sys/wait.h> #include <sys/un.h> #include <ctype.h> #include <dirent.h> @@ -1078,6 +1079,8 @@ int start_mdmon(int devnum) { int i; int len; + pid_t pid; + int status; char pathbuf[1024]; char *paths[4] = { pathbuf, @@ -1117,7 +1120,10 @@ int start_mdmon(int devnum) case -1: fprintf(stderr, Name ": cannot run mdmon. " "Array remains readonly\n"); return -1; - default: ; /* parent - good */ + default: /* parent - good */ + pid = wait(&status); + if (pid < 0 || status != 0) + return -1; } return 0; } |