summaryrefslogtreecommitdiff
path: root/Assemble.c
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2017-05-12 12:32:07 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2017-05-12 12:32:07 +0100
commit77b19ed5f259bc62680acf2b1a3454baa2472bc5 (patch)
tree7441d8d057c09e54c8ea23c984f2ccdf22c98649 /Assemble.c
parentca114f3c76374493f0fd64f8ea0a9b96ae9b1dc5 (diff)
New upstream release.
Diffstat (limited to 'Assemble.c')
-rw-r--r--Assemble.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/Assemble.c b/Assemble.c
index d199afc9..3da09033 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -599,18 +599,9 @@ static int load_devices(struct devs *devices, char *devmap,
int err;
fstat(mdfd, &stb2);
- if (strcmp(c->update, "uuid")==0 &&
- !ident->uuid_set) {
- int rfd;
- if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
- read(rfd, ident->uuid, 16) != 16) {
- *(__u32*)(ident->uuid) = random();
- *(__u32*)(ident->uuid+1) = random();
- *(__u32*)(ident->uuid+2) = random();
- *(__u32*)(ident->uuid+3) = random();
- }
- if (rfd >= 0) close(rfd);
- }
+ if (strcmp(c->update, "uuid") == 0 && !ident->uuid_set)
+ random_uuid((__u8 *)ident->uuid);
+
dfd = dev_open(devname,
tmpdev->disposition == 'I'
? O_RDWR : (O_RDWR|O_EXCL));
@@ -1880,10 +1871,9 @@ int assemble_container_content(struct supertype *st, int mdfd,
struct mdinfo *dev, *sra, *dev2;
int working = 0, preexist = 0;
int expansion = 0;
- struct map_ent *map = NULL;
int old_raid_disks;
int start_reshape;
- char *avail = NULL;
+ char *avail;
int err;
sysfs_init(content, mdfd, NULL);
@@ -1896,8 +1886,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
content->text_version[0] == '/')
content->text_version[0] = '-';
if (sysfs_set_array(content, md_get_version(mdfd)) != 0) {
- if (sra)
- sysfs_free(sra);
+ sysfs_free(sra);
return 1;
}
}
@@ -1950,11 +1939,9 @@ int assemble_container_content(struct supertype *st, int mdfd,
free(avail);
return 1;/* Nothing new, don't try to start */
}
- map_update(&map, fd2devnm(mdfd),
- content->text_version,
+ map_update(NULL, fd2devnm(mdfd), content->text_version,
content->uuid, chosen_name);
-
if (enough(content->array.level, content->array.raid_disks,
content->array.layout, content->array.state & 1, avail) == 0) {
if (c->export && result)