]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdmon.c
Remove st->text_version in favour of info->text_version
[thirdparty/mdadm.git] / mdmon.c
diff --git a/mdmon.c b/mdmon.c
index c8a3341effc59ac0338f513cb03b6edb0671bcf3..323ee62ee56ed37617dbda90a330d18813815490 100644 (file)
--- a/mdmon.c
+++ b/mdmon.c
@@ -48,6 +48,12 @@ struct md_generic_cmd *active_cmd;
 int run_child(void *v)
 {
        struct supertype *c = v;
+       sigset_t set;
+       /* SIGUSR is sent from child to parent,  So child must block it */
+       sigemptyset(&set);
+       sigaddset(&set, SIGUSR1);
+       sigprocmask(SIG_BLOCK, &set, NULL);
+
        do_monitor(c);
        return 0;
 }
@@ -140,6 +146,14 @@ static void try_kill_monitor(char *devname)
                kill(pid, SIGTERM);
 }
 
+void remove_pidfile(char *devname)
+{
+       char buf[100];
+
+       sprintf(buf, "/var/run/mdadm/%s.pid", devname);
+       unlink(buf);
+}
+
 static int make_control_sock(char *devname)
 {
        char path[100];
@@ -190,9 +204,9 @@ int main(int argc, char *argv[])
        /* hopefully it is a container - we'll check later */
 
        container = malloc(sizeof(*container));
-       container->devfd = mdfd;
        container->devnum = fd2devnum(mdfd);
        container->devname = devnum2devname(container->devnum);
+       container->device_name = argv[1];
 
        /* If this fails, we hope it already exists */
        mkdir("/var/run/mdadm", 0600);
@@ -262,7 +276,8 @@ int main(int argc, char *argv[])
                        argv[1]);
                exit(3);
        }
-
+       close(mdfd);
+       close(mdfd);
 
        mlockall(MCL_FUTURE);