1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix incorrect tests for dm_snprintf() failure

As the memory is preallocated based on arg size in these cases,
the error would be quite hard to trigger here anyway.
This commit is contained in:
Zdenek Kabelac 2011-04-09 19:05:23 +00:00
parent a1eba521e3
commit c67d2b4dd4
4 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.85 - Version 2.02.85 -
=================================== ===================================
Fix incorrect tests for dm_snprintf() failure.
Fix some unmatching sign comparation gcc warnings in the code. Fix some unmatching sign comparation gcc warnings in the code.
Allow lv_extend() to work on zero length intrinsically layered LVs. Allow lv_extend() to work on zero length intrinsically layered LVs.
Keep the cache content when the exported vg buffer is matching. Keep the cache content when the exported vg buffer is matching.

View File

@ -2296,7 +2296,7 @@ static int _rename_sub_lv(struct cmd_context *cmd,
log_error("Failed to allocate space for new name"); log_error("Failed to allocate space for new name");
return 0; return 0;
} }
if (!dm_snprintf(new_name, len, "%s%s", lv_name_new, suffix)) { if (dm_snprintf(new_name, len, "%s%s", lv_name_new, suffix) < 0) {
log_error("Failed to create new name"); log_error("Failed to create new name");
return 0; return 0;
} }

View File

@ -1787,7 +1787,7 @@ static struct logical_volume *_set_up_mirror_log(struct cmd_context *cmd,
} else if ((lv_name = strstr(lv->name, MIRROR_SYNC_LAYER))) { } else if ((lv_name = strstr(lv->name, MIRROR_SYNC_LAYER))) {
len = lv_name - lv->name + 1; len = lv_name - lv->name + 1;
if (!(tmp_name = alloca(len)) || if (!(tmp_name = alloca(len)) ||
!dm_snprintf(tmp_name, len, "%s", lv->name)) { (dm_snprintf(tmp_name, len, "%s", lv->name) < 0)) {
log_error("mirror log name allocation failed"); log_error("mirror log name allocation failed");
return 0; return 0;
} }

View File

@ -481,7 +481,7 @@ int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv,
if (!uuid || !lv_full_name) if (!uuid || !lv_full_name)
return_0; return_0;
if (!dm_snprintf(lv_full_name, len, "%s/%s", lv->vg->name, lv->name)) if (dm_snprintf(lv_full_name, len, "%s/%s", lv->vg->name, lv->name) < 0)
return_0; return_0;
memcpy(uuid, &lv->lvid, sizeof(lv->lvid)); memcpy(uuid, &lv->lvid, sizeof(lv->lvid));