sim_linuxi2c: fix snprintf parameter

use `sizeof` instead of constant number

Signed-off-by: xinbingnan <xinbingnan@xiaomi.com>
This commit is contained in:
xinbingnan 2023-03-20 12:23:06 +08:00 committed by Petro Karashchenko
parent bb281eedfa
commit 14d1f3b995
1 changed files with 1 additions and 1 deletions

View File

@ -276,7 +276,7 @@ struct i2c_master_s *sim_i2cbus_initialize(int bus)
return NULL;
}
snprintf(filename, 19, "/dev/i2c-%d", bus);
snprintf(filename, sizeof(filename), "/dev/i2c-%d", bus);
priv->file = open(filename, O_RDWR);
if (priv->file < 0)
{