Merge pull request #449 from JacobBarthelmeh/qnx

fix for DIR with QNX
pull/452/head
John Safranek 2022-09-01 13:32:41 -07:00 committed by GitHub
commit c1f473d52b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 2 deletions

View File

@ -47,6 +47,7 @@
#endif
#include "configuration.h"
#include <dirent.h>
struct WOLFSSHD_CONFIG {
void* heap;
@ -650,7 +651,15 @@ static int HandleInclude(WOLFSSHD_CONFIG *conf, const char *value)
/* Count up the number of files */
while ((dir = WREADDIR(&d)) != NULL) {
/* Skip sub-directories */
if (dir->d_type != DT_DIR) {
#if defined(__QNX__) || defined(__QNXNTO__)
struct stat s;
lstat(dir->d_name, &s);
if (!S_ISDIR(s.st_mode))
#else
if (dir->d_type != DT_DIR)
#endif
{
fileCount++;
}
}
@ -668,7 +677,15 @@ static int HandleInclude(WOLFSSHD_CONFIG *conf, const char *value)
i = 0;
while (i < fileCount && (dir = WREADDIR(&d)) != NULL) {
/* Skip sub-directories */
if (dir->d_type != DT_DIR) {
#if defined(__QNX__) || defined(__QNXNTO__)
struct stat s;
lstat(dir->d_name, &s);
if (!S_ISDIR(s.st_mode))
#else
if (dir->d_type != DT_DIR)
#endif
{
/* Insert in string order */
for (j = 0; j < i; j++) {
if (WSTRCMP(dir->d_name, fileNames[j])