mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Replace snprintf with dm_snprintf
snprintf testing for negative is replaced with dm_snprintf where this test really works. Add missing test for result of dm_snprintf().
This commit is contained in:
parent
a6292f2a6d
commit
d75c5f06f0
@ -60,7 +60,7 @@ static int get_sysfs_get_major_minor(const char *sysfs_dir, const char *kname, i
|
||||
{
|
||||
char path[PATH_MAX], buffer[64];
|
||||
|
||||
if (snprintf(path, sizeof(path), "%s/block/%s/dev", sysfs_dir, kname) < 0)
|
||||
if (dm_snprintf(path, sizeof(path), "%s/block/%s/dev", sysfs_dir, kname) < 0)
|
||||
return_0;
|
||||
|
||||
if (!get_sysfs_string(path, buffer, sizeof(buffer)))
|
||||
|
@ -696,9 +696,11 @@ static int _split_mirror_images(struct logical_volume *lv,
|
||||
dm_list_iterate_items(lvl, &split_images) {
|
||||
sub_lv = lvl->lv;
|
||||
|
||||
dm_snprintf(format, len, "%s_mimage_%%d",
|
||||
new_lv->name);
|
||||
|
||||
if (dm_snprintf(format, len, "%s_mimage_%%d",
|
||||
new_lv->name) < 0) {
|
||||
log_error("Failed to build new image name.");
|
||||
return 0;
|
||||
}
|
||||
layer_name = dm_pool_alloc(lv->vg->vgmem, len);
|
||||
if (!layer_name) {
|
||||
log_error("Unable to allocate memory");
|
||||
|
@ -28,7 +28,7 @@ static char *_expand_filename(const char *template, const char *vg_name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (snprintf(filename, PATH_MAX, template, vg_name) < 0) {
|
||||
if (dm_snprintf(filename, PATH_MAX, template, vg_name) < 0) {
|
||||
log_error("Error processing filename template %s",
|
||||
template);
|
||||
dm_free(filename);
|
||||
|
Loading…
Reference in New Issue
Block a user