You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/09/06 15:01:25 UTC
[incubator-nuttx-apps] branch master updated: nshlib/netcmd: add sanity check for netdev
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new e6e466113 nshlib/netcmd: add sanity check for netdev
e6e466113 is described below
commit e6e46611315eefc220c4db851b7ccb10cc8e7aaf
Author: chao an <an...@xiaomi.com>
AuthorDate: Mon Sep 5 22:25:19 2022 +0800
nshlib/netcmd: add sanity check for netdev
Signed-off-by: chao an <an...@xiaomi.com>
---
nshlib/nsh_netcmds.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c
index d9e0754c9..8443d4ff7 100644
--- a/nshlib/nsh_netcmds.c
+++ b/nshlib/nsh_netcmds.c
@@ -368,6 +368,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
FAR char *cmd)
{
FAR struct dirent *entry;
+ uint8_t flags;
FAR DIR *dir;
int ret = OK;
@@ -392,7 +393,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
*/
if (entry->d_type == DTYPE_FILE &&
- strcmp(entry->d_name, "stat") != 0)
+ netlib_getifstatus(entry->d_name, &flags) >= 0)
{
/* Performt he callback. It returns any non-zero value, then
* terminate the search.