Commit 23d39f63 authored by Milan Broz's avatar Milan Broz Committed by Alasdair G Kergon

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: default avatarMilan Broz <mbroz@redhat.com>
Reviewed-by: default avatarAlasdair G Kergon <agk@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent ac1f0ac2
...@@ -1550,8 +1550,10 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) ...@@ -1550,8 +1550,10 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
goto out; goto out;
} }
strcpy(name, hc->name); if (name)
strcpy(uuid, hc->uuid ? : ""); strcpy(name, hc->name);
if (uuid)
strcpy(uuid, hc->uuid ? : "");
out: out:
up_read(&_hash_lock); up_read(&_hash_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment