Skip to content

Commit

Permalink
dm ioctl: allow dm_copy_name_and_uuid to return only one field
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Milan Broz authored and Alasdair G Kergon committed Jan 6, 2009
1 parent ac1f0ac commit 23d39f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/md/dm-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1550,8 +1550,10 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
goto out;
}

strcpy(name, hc->name);
strcpy(uuid, hc->uuid ? : "");
if (name)
strcpy(name, hc->name);
if (uuid)
strcpy(uuid, hc->uuid ? : "");

out:
up_read(&_hash_lock);
Expand Down

0 comments on commit 23d39f6

Please sign in to comment.