Fix error path for DM UUID wrong format.

This commit is contained in:
Milan Broz
2013-10-20 13:06:16 +02:00
parent f547d0fac3
commit 3f66e9fe4b

View File

@@ -516,7 +516,7 @@ static int dm_prepare_uuid(const char *name, const char *type, const char *uuid,
if (uuid) { if (uuid) {
if (uuid_parse(uuid, uu) < 0) { if (uuid_parse(uuid, uu) < 0) {
log_dbg("Requested UUID %s has invalid format.", uuid); log_dbg("Requested UUID %s has invalid format.", uuid);
return -EINVAL; return 0;
} }
for (ptr = uuid2, i = 0; i < UUID_LEN; i++) for (ptr = uuid2, i = 0; i < UUID_LEN; i++)
@@ -535,7 +535,7 @@ static int dm_prepare_uuid(const char *name, const char *type, const char *uuid,
if (i >= buflen) if (i >= buflen)
log_err(NULL, _("DM-UUID for device %s was truncated.\n"), name); log_err(NULL, _("DM-UUID for device %s was truncated.\n"), name);
return 0; return 1;
} }
static int _dm_create_device(const char *name, const char *type, static int _dm_create_device(const char *name, const char *type,
@@ -562,9 +562,8 @@ static int _dm_create_device(const char *name, const char *type,
if (!dm_task_set_name(dmt, name)) if (!dm_task_set_name(dmt, name))
goto out_no_removal; goto out_no_removal;
} else { } else {
r = dm_prepare_uuid(name, type, uuid, dev_uuid, sizeof(dev_uuid)); if (!dm_prepare_uuid(name, type, uuid, dev_uuid, sizeof(dev_uuid)))
if (r < 0) goto out_no_removal;
return r;
if (!(dmt = dm_task_create(DM_DEVICE_CREATE))) if (!(dmt = dm_task_create(DM_DEVICE_CREATE)))
goto out_no_removal; goto out_no_removal;