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 | |
parent | b810c547004a98a7fc25c8dde65cf88d82ad9652 (diff) | |
download | lvm2-72b2cb613a57918dadf9722c59a30ca71d751c8e.tar.gz |
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')
-rw-r--r-- | lib/uuid/uuid.c | 11 | ||||
-rw-r--r-- | lib/uuid/uuid.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/uuid/uuid.c b/lib/uuid/uuid.c index 61e789308..fb60a26c6 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; diff --git a/lib/uuid/uuid.h b/lib/uuid/uuid.h index fcef414b4..1a327f8f6 100644 --- a/lib/uuid/uuid.h +++ b/lib/uuid/uuid.h @@ -20,7 +20,7 @@ #define ID_LEN_S "32" struct id { - uint8_t uuid[ID_LEN]; + int8_t uuid[ID_LEN]; }; /* |