]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
imsm: fix family number handling
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 00bf80378de615e8ece5d40ab4d56990062ea4c8..2543971026656ac8afca07c30d3d2f983a4a55a0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1298,6 +1298,17 @@ int check_env(char *name)
        return 0;
 }
 
+__u32 random32(void)
+{
+       __u32 rv;
+       int rfd = open("/dev/urandom", O_RDONLY);
+       if (rfd < 0 || read(rfd, &rv, 4) != 4)
+               rv = random();
+       if (rfd >= 0)
+               close(rfd);
+       return rv;
+}
+
 #ifndef MDASSEMBLE
 int flush_metadata_updates(struct supertype *st)
 {