From: Zdenek Kabelac Date: Fri, 30 Aug 2013 12:46:34 +0000 (+0200) Subject: libdm: new name can't be empty X-Git-Tag: v2_02_101~63 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=350cf7968c77d090b49fc41761221da930d60538;p=lvm2.git libdm: new name can't be empty Do not allow passing '' names to kernel. This test was missing also in kernel, so it has allowed to create device with '' name. This then confused dmsetup tool, since such name is unexpected and unsupported. To remove such name from table, user has to use -j -m to specify which device should be removed. This patch fixes the posibility to run this operation: dmsetup rename existingdev '' after this operation commands like 'dmsetup table' are failing. This patch prohibits to use such name. --- diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 3995187ac..f5d7dc2d9 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.80 - ================================== + Do not allow passing empty new name for dmsetup rename. Display any output returned by 'dmsetup message'. Add dm_task_get_message_response to libdevmapper. diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 904335241..c0669cbd5 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -698,6 +698,11 @@ int dm_task_set_newname(struct dm_task *dmt, const char *newname) return 0; } + if (!*newname) { + log_error("Non empty new name is required."); + return 0; + } + if (!check_multiple_mangled_string_allowed(newname, "new name", mangling_mode)) return_0;