]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdmon.c
imsm: remove redundant characters from some error messages
[thirdparty/mdadm.git] / mdmon.c
diff --git a/mdmon.c b/mdmon.c
index 8cd53d8b24be4cf0936f90943e397cbe1d1ae97e..e4b73d96b96c6482df7915daeb03b67b580f93fd 100644 (file)
--- a/mdmon.c
+++ b/mdmon.c
@@ -67,6 +67,8 @@
 #include       "mdadm.h"
 #include       "mdmon.h"
 
+char const Name[] = "mdmon";
+
 struct active_array *discard_this;
 struct active_array *pending_discard;
 
@@ -232,7 +234,8 @@ static int make_control_sock(char *devname)
 
        addr.sun_family = PF_LOCAL;
        strcpy(addr.sun_path, path);
-       if (bind(sfd, &addr, sizeof(addr)) < 0) {
+       umask(077); /* ensure no world write access */
+       if (bind(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
                close(sfd);
                return -1;
        }
@@ -429,6 +432,7 @@ static int mdmon(char *devnm, int must_fork, int takeover)
                                wait(&status);
                                status = WEXITSTATUS(status);
                        }
+                       close(pfd[0]);
                        return status;
                }
        } else
@@ -516,10 +520,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);
 
@@ -587,3 +593,10 @@ int save_stripes(int *source, unsigned long long *offsets,
 {
        return 0;
 }
+
+struct superswitch super0 = {
+       .name = "0.90",
+};
+struct superswitch super1 = {
+       .name = "1.x",
+};