mtd/partition: fix compile warning

include/nuttx/mtd/mtd.h: In function ‘mtd_setpartitionname’:
mtd/mtd_partition.c:909:3: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
  909 |   strncpy(priv->name, name, sizeof(priv->name));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
chao.an 2022-03-18 22:55:50 +08:00 committed by Xiang Xiao
parent 0f7ccf0c08
commit 6a212b1a2c
1 changed files with 1 additions and 1 deletions

View File

@ -906,7 +906,7 @@ int mtd_setpartitionname(FAR struct mtd_dev_s *mtd, FAR const char *name)
/* Allocate space for the name */ /* Allocate space for the name */
strncpy(priv->name, name, sizeof(priv->name)); strlcpy(priv->name, name, sizeof(priv->name));
return OK; return OK;
} }
#endif #endif