Fix cppcheck warning "Non reentrant function 'readdir' called"
This commit is contained in:
parent
8e2effdc53
commit
262555d568
1 changed files with 4 additions and 1 deletions
|
@ -271,7 +271,10 @@ spi_list_ports(void)
|
||||||
|
|
||||||
DIR *pdDir = opendir("/dev");
|
DIR *pdDir = opendir("/dev");
|
||||||
struct dirent *pdDirEnt;
|
struct dirent *pdDirEnt;
|
||||||
while ((pdDirEnt = readdir(pdDir)) != NULL) {
|
struct dirent entry;
|
||||||
|
struct dirent *result;
|
||||||
|
while ((readdir_r(pdDir, &entry, &result) == 0) && (result != NULL)) {
|
||||||
|
pdDirEnt = &entry;
|
||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
if (!isdigit(pdDirEnt->d_name[strlen(pdDirEnt->d_name) - 1]))
|
if (!isdigit(pdDirEnt->d_name[strlen(pdDirEnt->d_name) - 1]))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue