diff options
author | Alasdair Kergon <agk@redhat.com> | 2006-05-09 21:23:51 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2006-05-09 21:23:51 +0000 |
commit | 72b2cb613a57918dadf9722c59a30ca71d751c8e (patch) | |
tree | ae0130e37b873591370abd65ff44cb2a554db049 /lib/uuid/uuid.c | |
parent | b810c547004a98a7fc25c8dde65cf88d82ad9652 (diff) | |
download | lvm2-72b2cb613a57918dadf9722c59a30ca71d751c8e.tar.gz lvm2-72b2cb613a57918dadf9722c59a30ca71d751c8e.tar.xz lvm2-72b2cb613a57918dadf9722c59a30ca71d751c8e.zip |
Make SIZE_SHORT the default for display_size().
Fix some memory leaks in error paths found by coverity.
Use C99 struct initialisers.
Move DEFS into configure.h.
Clean-ups to remove miscellaneous compiler warnings.
Diffstat (limited to 'lib/uuid/uuid.c')
-rw-r--r-- | lib/uuid/uuid.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/uuid/uuid.c b/lib/uuid/uuid.c index 61e78930..fb60a26c 100644 --- a/lib/uuid/uuid.c +++ b/lib/uuid/uuid.c @@ -20,11 +20,11 @@ #include <fcntl.h> #include <unistd.h> -static unsigned char _c[] = +static char _c[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#"; static int _built_inverse; -static unsigned char _inverse_c[256]; +static char _inverse_c[256]; int lvid_create(union lvid *lvid, struct id *vgid) { @@ -63,7 +63,7 @@ int lvid_from_lvnum(union lvid *lvid, struct id *vgid, uint32_t lv_num) int lvnum_from_lvid(union lvid *lvid) { int i, lv_num = 0; - unsigned char *c; + char *c; for (i = 0; i < ID_LEN; i++) { lv_num *= sizeof(_c) - 1; @@ -76,7 +76,8 @@ int lvnum_from_lvid(union lvid *lvid) int id_create(struct id *id) { - int randomfile, i; + int randomfile; + unsigned i; size_t len = sizeof(id->uuid); memset(id->uuid, 0, len); @@ -85,7 +86,7 @@ int id_create(struct id *id) return 0; } - if (read(randomfile, id->uuid, len) != len) { + if (read(randomfile, id->uuid, len) != (ssize_t) len) { log_sys_error("read", "id_create: /dev/urandom"); if (close(randomfile)) stack; |