diff options
author | Alasdair Kergon <agk@redhat.com> | 2005-01-20 18:11:53 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2005-01-20 18:11:53 +0000 |
commit | 52f9afec22020d7bc2ebc940d83ee516328f7b61 (patch) | |
tree | 5360083750df439a56cf1acf8f8c80013c7d76a7 /lib/uuid | |
parent | c44c015a2d3bf0d2f5605c062c03375b4f73cd27 (diff) | |
download | lvm2-52f9afec22020d7bc2ebc940d83ee516328f7b61.tar.gz |
Always fail if random id generation fails.
Diffstat (limited to 'lib/uuid')
-rw-r--r-- | lib/uuid/uuid.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/uuid/uuid.c b/lib/uuid/uuid.c index f86ba9f83..61e789308 100644 --- a/lib/uuid/uuid.c +++ b/lib/uuid/uuid.c @@ -29,9 +29,7 @@ static unsigned char _inverse_c[256]; int lvid_create(union lvid *lvid, struct id *vgid) { memcpy(lvid->id, vgid, sizeof(*lvid->id)); - id_create(&lvid->id[1]); - - return 1; + return id_create(&lvid->id[1]); } void uuid_from_num(char *uuid, uint32_t num) @@ -83,16 +81,18 @@ int id_create(struct id *id) memset(id->uuid, 0, len); if ((randomfile = open("/dev/urandom", O_RDONLY)) < 0) { - log_sys_error("open", "id_create"); + log_sys_error("open", "id_create: /dev/urandom"); return 0; } if (read(randomfile, id->uuid, len) != len) { - log_sys_error("read", "id_create"); - close(randomfile); + log_sys_error("read", "id_create: /dev/urandom"); + if (close(randomfile)) + stack; return 0; } - close(randomfile); + if (close(randomfile)) + stack; /* * Skip out the last 2 chars in randomized creation for LVM1 |