sim_linuxi2c: fix snprintf parameter
use `sizeof` instead of constant number Signed-off-by: xinbingnan <xinbingnan@xiaomi.com>
This commit is contained in:
parent
bb281eedfa
commit
14d1f3b995
@ -276,7 +276,7 @@ struct i2c_master_s *sim_i2cbus_initialize(int bus)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(filename, 19, "/dev/i2c-%d", bus);
|
snprintf(filename, sizeof(filename), "/dev/i2c-%d", bus);
|
||||||
priv->file = open(filename, O_RDWR);
|
priv->file = open(filename, O_RDWR);
|
||||||
if (priv->file < 0)
|
if (priv->file < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user