nshlib/netcmd: add sanity check for netdev
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
37b77a78fa
commit
e6e4661131
@ -368,6 +368,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
|
|||||||
FAR char *cmd)
|
FAR char *cmd)
|
||||||
{
|
{
|
||||||
FAR struct dirent *entry;
|
FAR struct dirent *entry;
|
||||||
|
uint8_t flags;
|
||||||
FAR DIR *dir;
|
FAR DIR *dir;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
@ -392,7 +393,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (entry->d_type == DTYPE_FILE &&
|
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
|
/* Performt he callback. It returns any non-zero value, then
|
||||||
* terminate the search.
|
* terminate the search.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user