util/path: handle missing d_type definitions on Solaris

Guard DT_REG usage so directory walking code still builds on platforms where dirent does not expose d_type or DT_REG, such as Solaris.
pull/15601/head
Martin Rehak 3 months ago committed by Victor Julien
parent e39075557a
commit 955827bc59

@ -304,7 +304,7 @@ TmEcode PcapDirectoryPopulateBuffer(PcapFileDirectoryVars *pv,
PendingFile *file_to_add = NULL; PendingFile *file_to_add = NULL;
while ((dir = readdir(pv->directory)) != NULL) { while ((dir = readdir(pv->directory)) != NULL) {
#ifndef OS_WIN32 #if defined(DT_REG)
if (dir->d_type != DT_REG) { if (dir->d_type != DT_REG) {
continue; continue;
} }

@ -196,7 +196,7 @@ bool SCPathExists(const char *path)
*/ */
bool SCIsRegularDirectory(const struct dirent *const dir_entry) bool SCIsRegularDirectory(const struct dirent *const dir_entry)
{ {
#ifndef OS_WIN32 #if !defined(OS_WIN32) && !defined(__sun)
if ((dir_entry->d_type == DT_DIR) && if ((dir_entry->d_type == DT_DIR) &&
(strcmp(dir_entry->d_name, ".") != 0) && (strcmp(dir_entry->d_name, ".") != 0) &&
(strcmp(dir_entry->d_name, "..") != 0)) { (strcmp(dir_entry->d_name, "..") != 0)) {
@ -214,7 +214,7 @@ bool SCIsRegularDirectory(const struct dirent *const dir_entry)
*/ */
bool SCIsRegularFile(const struct dirent *const dir_entry) bool SCIsRegularFile(const struct dirent *const dir_entry)
{ {
#ifndef OS_WIN32 #if defined(DT_REG)
return dir_entry->d_type == DT_REG; return dir_entry->d_type == DT_REG;
#endif #endif
return false; return false;

Loading…
Cancel
Save