]> sourceware.org Git - lvm2.git/commitdiff
Check id_write_format result
authorZdenek Kabelac <zkabelac@redhat.com>
Mon, 27 Feb 2012 11:32:48 +0000 (11:32 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 27 Feb 2012 11:32:48 +0000 (11:32 +0000)
Currently we never fail with 64byte uuid buffer,
but just stay consitent with rest of the code and check for result.

lib/cache/lvmetad.c

index 6d34382eb602772bab09a967b3aa36aab179d7d2..e7bd4b416141745efacca7ace8de7285b4ccb63a 100644 (file)
@@ -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)))
This page took 0.031881 seconds and 5 git commands to generate.