dm ioctl: allow dm_copy_name_and_uuid to return only one field

Allow NULL buffer in dm_copy_name_and_uuid if you only want to return one of
the fields.

(Required by a following patch that adds these fields to sysfs.)

Signed-off-by: Milan Broz <mbroz@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
Milan Broz 2009-01-06 03:05:04 +00:00 committed by Alasdair G Kergon
parent ac1f0ac22c
commit 23d39f63aa
1 changed files with 4 additions and 2 deletions

View File

@ -1550,7 +1550,9 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
goto out; goto out;
} }
if (name)
strcpy(name, hc->name); strcpy(name, hc->name);
if (uuid)
strcpy(uuid, hc->uuid ? : ""); strcpy(uuid, hc->uuid ? : "");
out: out: