1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

device_id: use faster dm_strncpy

This commit is contained in:
Zdenek Kabelac 2024-05-27 21:31:54 +02:00
parent fbdd26a4a3
commit 9207bae33b

View File

@ -2513,7 +2513,7 @@ static int _match_du_to_dev(struct cmd_context *cmd, struct dev_use *du, struct
* string is modified to t10.123_456 so that it will match the value * string is modified to t10.123_456 so that it will match the value
* returned from device_id_system_read(). * returned from device_id_system_read().
*/ */
strncpy(du_idname, du->idname, PATH_MAX-1); dm_strncpy(du_idname, du->idname, sizeof(du_idname));
if (((du->idtype == DEV_ID_TYPE_SYS_WWID) || (du->idtype == DEV_ID_TYPE_SYS_SERIAL)) && if (((du->idtype == DEV_ID_TYPE_SYS_WWID) || (du->idtype == DEV_ID_TYPE_SYS_SERIAL)) &&
strchr(du_idname, '_')) { strchr(du_idname, '_')) {
_remove_leading_underscores(du_idname, sizeof(du_idname)); _remove_leading_underscores(du_idname, sizeof(du_idname));