diff options
author | NeilBrown <neilb@suse.de> | 2009-05-11 16:05:41 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-05-11 16:05:41 +1000 |
commit | 8320878543bb5e49b5acb24fa919ff11be485c61 (patch) | |
tree | 299b6ca3d559d818f4b8dd25756c3f5feda0e91f /super1.c | |
parent | 9a40c32728dceb66bac603e96656223944b6c7d4 (diff) | |
parent | c9f39c1b9bafbd18ce3831c8da6865b21827fef3 (diff) | |
download | mdadm-8320878543bb5e49b5acb24fa919ff11be485c61.tar.gz |
Merge branch 'master' into devel-3.0
Conflicts:
Build.c
mdadm.c
mdadm.h
super1.c
Diffstat (limited to 'super1.c')
-rw-r--r-- | super1.c | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -687,10 +687,8 @@ static int update_super1(struct supertype *st, struct mdinfo *info, if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 || read(rfd, sb->device_uuid, 16) != 16) { - *(__u32*)(sb->device_uuid) = random(); - *(__u32*)(sb->device_uuid+4) = random(); - *(__u32*)(sb->device_uuid+8) = random(); - *(__u32*)(sb->device_uuid+12) = random(); + __u32 r[4] = {random(), random(), random(), random()}; + memcpy(sb->device_uuid, r, 16); } sb->dev_roles[i] = @@ -816,10 +814,8 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info, else { if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 || read(rfd, sb->set_uuid, 16) != 16) { - *(__u32*)(sb->set_uuid) = random(); - *(__u32*)(sb->set_uuid+4) = random(); - *(__u32*)(sb->set_uuid+8) = random(); - *(__u32*)(sb->set_uuid+12) = random(); + __u32 r[4] = {random(), random(), random(), random()}; + memcpy(sb->set_uuid, r, 16); } if (rfd >= 0) close(rfd); } @@ -1023,12 +1019,12 @@ static int write_init_super1(struct supertype *st) if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 || read(rfd, sb->device_uuid, 16) != 16) { - *(__u32*)(sb->device_uuid) = random(); - *(__u32*)(sb->device_uuid+4) = random(); - *(__u32*)(sb->device_uuid+8) = random(); - *(__u32*)(sb->device_uuid+12) = random(); + __u32 r[4] = {random(), random(), random(), random()}; + memcpy(sb->device_uuid, r, 16); } - if (rfd >= 0) close(rfd); + if (rfd >= 0) + close(rfd); + sb->events = 0; refst =*st; |