]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-ddf.c
Add secure gethostname() wrapper
[thirdparty/mdadm.git] / super-ddf.c
index 7213284e0a596069c3a378e99094a19351a82b1f..c5242654df3cb6ac328ade1416157e241733d10f 100644 (file)
@@ -2364,8 +2364,7 @@ static int init_super_ddf(struct supertype *st,
         * Remaining 16 are serial number.... maybe a hostname would do?
         */
        memcpy(ddf->controller.guid, T10, sizeof(T10));
-       gethostname(hostname, sizeof(hostname));
-       hostname[sizeof(hostname) - 1] = 0;
+       s_gethostname(hostname, sizeof(hostname));
        hostlen = strlen(hostname);
        memcpy(ddf->controller.guid + 24 - hostlen, hostname, hostlen);
        for (i = strlen(T10) ; i+hostlen < 24; i++)