--- current/lib/activate/devmapper.c.orig 2007-11-13 13:51:11.000000000 +0100
+++ current/lib/activate/devmapper.c 2007-11-16 12:42:14.000000000 +0100
@@ -151,13 +151,16 @@
/* Build a UUID for a dmraid device
* Return 1 for sucess; 0 for failure*/
-static int dmraid_uuid(char *uuid, struct lib_context *lc,
- struct raid_set *rs, uint uuid_len) {
+static int dmraid_uuid(struct lib_context *lc, struct raid_set *rs,
+ char *uuid, uint uuid_len) {
+ int r;
+
/* Clear garbage data from uuid string */
memset(uuid, 0, uuid_len);
-
- /* Insert volume name into string */
- return !!memcpy(uuid, rs->name, strlen(rs->name));
+
+ /* Create UUID string from subsystem prefix and RAID set name. */
+ r = snprintf(uuid, uuid_len, "DMRAID-%s", rs->name) < uuid_len;
+ return r < 0 ? 0 : (r < uuid_len);
}
/* Create a task, set its name and run it. */
@@ -178,12 +181,11 @@
if (ret && table)
ret = parse_table(lc, dmt, table);
- if (ret) {
- if (DM_DEVICE_CREATE == type &&
- dmraid_uuid(uuid, lc, rs, DM_UUID_LEN))
- dm_task_set_uuid(dmt, uuid);
- ret = dm_task_run(dmt);
- }
+ if (ret &&
+ DM_DEVICE_CREATE == type)
+ ret = dmraid_uuid(lc, rs, uuid, DM_UUID_LEN) &&
+ dm_task_set_uuid(dmt, uuid) &&
+ dm_task_run(dmt);
_exit_dm(dmt);
return ret;