]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdadm.c
Add secure gethostname() wrapper
[thirdparty/mdadm.git] / mdadm.c
diff --git a/mdadm.c b/mdadm.c
index 4685ad6b06c2becd8d7110247abe34af7bf08411..e32598cb15a4577e91f4a5d1853f8e4176ceb51d 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -107,8 +107,8 @@ int main(int argc, char *argv[])
 
        srandom(time(0) ^ getpid());
 
-       if (get_linux_version() < 2006015) {
-               pr_err("This version of mdadm does not support kernels older than 2.6.15\n");
+       if (get_linux_version() < 2006032) {
+               pr_err("This version of mdadm does not support kernels older than 2.6.32\n");
                exit(1);
        }
 
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
                        continue;
 
                case HomeHost:
-                       if (strcasecmp(optarg, "<ignore>") == 0)
+                       if (is_devname_ignore(optarg) == true)
                                c.require_homehost = 0;
                        else
                                c.homehost = optarg;
@@ -1340,8 +1340,7 @@ int main(int argc, char *argv[])
        if (c.homehost == NULL && c.require_homehost)
                c.homehost = conf_get_homehost(&c.require_homehost);
        if (c.homehost == NULL || strcasecmp(c.homehost, "<system>") == 0) {
-               if (gethostname(sys_hostname, sizeof(sys_hostname)) == 0) {
-                       sys_hostname[sizeof(sys_hostname)-1] = 0;
+               if (s_gethostname(sys_hostname, sizeof(sys_hostname)) == 0) {
                        c.homehost = sys_hostname;
                }
        }
@@ -1749,8 +1748,7 @@ static int scan_assemble(struct supertype *ss,
                        int r;
                        if (a->assembled)
                                continue;
-                       if (a->devname &&
-                           strcasecmp(a->devname, "<ignore>") == 0)
+                       if (a->devname && is_devname_ignore(a->devname) == true)
                                continue;
 
                        r = Assemble(ss, a->devname,