summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/util.c b/util.c
index 00bf803..2543971 100644
--- 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)
{