Replace strlen with sizeof for kconfig string
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
956b935511
commit
6aa05b5855
@ -89,7 +89,7 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
/* Set up the server address */
|
||||
|
||||
addrlen = strlen(CONFIG_EXAMPLES_UDGRAM_ADDR) + 1;
|
||||
addrlen = sizeof(CONFIG_EXAMPLES_UDGRAM_ADDR);
|
||||
if (addrlen > UNIX_PATH_MAX)
|
||||
{
|
||||
addrlen = UNIX_PATH_MAX;
|
||||
|
@ -91,7 +91,7 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
/* Bind the socket to a local address */
|
||||
|
||||
addrlen = strlen(CONFIG_EXAMPLES_UDGRAM_ADDR) + 1;
|
||||
addrlen = sizeof(CONFIG_EXAMPLES_UDGRAM_ADDR);
|
||||
if (addrlen > UNIX_PATH_MAX)
|
||||
{
|
||||
addrlen = UNIX_PATH_MAX;
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
/* Connect the socket to the server */
|
||||
|
||||
addrlen = strlen(CONFIG_EXAMPLES_USTREAM_ADDR) + 1;
|
||||
addrlen = sizeof(CONFIG_EXAMPLES_USTREAM_ADDR);
|
||||
if (addrlen > UNIX_PATH_MAX)
|
||||
{
|
||||
addrlen = UNIX_PATH_MAX;
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Bind the socket to a local address */
|
||||
|
||||
addrlen = strlen(CONFIG_EXAMPLES_USTREAM_ADDR) + 1;
|
||||
addrlen = sizeof(CONFIG_EXAMPLES_USTREAM_ADDR);
|
||||
if (addrlen > UNIX_PATH_MAX)
|
||||
{
|
||||
addrlen = UNIX_PATH_MAX;
|
||||
|
@ -142,7 +142,7 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
{
|
||||
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
|
||||
if (strncmp(filepath, CONFIG_NSH_PROC_MOUNTPOINT,
|
||||
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
|
||||
sizeof(CONFIG_NSH_PROC_MOUNTPOINT) - 1) == 0)
|
||||
{
|
||||
nsh_error(vtbl,
|
||||
"nsh: %s: Could not open %s (is procfs mounted?)\n",
|
||||
@ -386,7 +386,7 @@ int nsh_writefile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
{
|
||||
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
|
||||
if (strncmp(filepath, CONFIG_NSH_PROC_MOUNTPOINT,
|
||||
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
|
||||
sizeof(CONFIG_NSH_PROC_MOUNTPOINT) - 1) == 0)
|
||||
{
|
||||
nsh_error(vtbl,
|
||||
"nsh: %s: Could not open %s (is procfs mounted?)\n",
|
||||
@ -445,7 +445,7 @@ int nsh_foreach_direntry(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
|
||||
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
|
||||
if (strncmp(dirpath, CONFIG_NSH_PROC_MOUNTPOINT,
|
||||
strlen(CONFIG_NSH_PROC_MOUNTPOINT)) == 0)
|
||||
sizeof(CONFIG_NSH_PROC_MOUNTPOINT) - 1) == 0)
|
||||
{
|
||||
nsh_error(vtbl,
|
||||
"nsh: %s: Could not open %s (is procfs mounted?)\n",
|
||||
|
Loading…
Reference in New Issue
Block a user