diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2012-02-27 11:32:48 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2012-02-27 11:32:48 +0000 |
commit | a68f04f41c4d364763be07b59d181951cf70d070 (patch) | |
tree | 4f7e9d971c48087e3c6a4e6cdc5448de3a1bd5bb /lib/cache/lvmetad.c | |
parent | c5b8faf3b10268d6269b4ed2e4fb21326a6af315 (diff) | |
download | lvm2-a68f04f41c4d364763be07b59d181951cf70d070.tar.gz lvm2-a68f04f41c4d364763be07b59d181951cf70d070.tar.xz lvm2-a68f04f41c4d364763be07b59d181951cf70d070.zip |
Check id_write_format result
Currently we never fail with 64byte uuid buffer,
but just stay consitent with rest of the code and check for result.
Diffstat (limited to 'lib/cache/lvmetad.c')
-rw-r--r-- | lib/cache/lvmetad.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c index 6d34382e..e7bd4b41 100644 --- a/lib/cache/lvmetad.c +++ b/lib/cache/lvmetad.c @@ -153,7 +153,8 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna return NULL; if (vgid) { - id_write_format((const struct id*)vgid, uuid, 64); + if (!id_write_format((const struct id*)vgid, uuid, sizeof(uuid))) + return_0; reply = daemon_send_simple(_lvmetad, "vg_lookup", "uuid = %s", uuid, NULL); } else { if (!vgname) @@ -293,7 +294,9 @@ int lvmetad_vg_remove(struct volume_group *vg) if (!_using_lvmetad) return 1; /* just fake it */ - id_write_format(&vg->id, uuid, 64); + if (!id_write_format(&vg->id, uuid, sizeof(uuid))) + return_0; + reply = daemon_send_simple(_lvmetad, "vg_remove", "uuid = %s", uuid, NULL); return _lvmetad_handle_reply(reply, "remove VG", vg->name); @@ -309,7 +312,8 @@ int lvmetad_pv_lookup(struct cmd_context *cmd, struct id pvid) if (!_using_lvmetad) return_0; - id_write_format(&pvid, uuid, 64); + if (!id_write_format(&pvid, uuid, sizeof(uuid))) + return_0; reply = daemon_send_simple(_lvmetad, "pv_lookup", "uuid = %s", uuid, NULL); @@ -482,7 +486,8 @@ int lvmetad_pv_found(struct id pvid, struct device *device, const struct format_ if (!_using_lvmetad) return 1; - id_write_format(&pvid, uuid, 64); + if (!id_write_format(&pvid, uuid, sizeof(uuid))) + return_0; /* FIXME A more direct route would be much preferable. */ if ((info = lvmcache_info_from_pvid((const char *)&pvid, 0))) |