summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2018-10-05 16:34:35 -0700
committerIan Romanick <ian.d.romanick@intel.com>2018-10-05 17:30:45 -0700
commit066850edadfe2aa0d339a0c6211ef0a61755a415 (patch)
tree03a64b75827cd8dccd7a0c5d5f0563bb50385b15
parent084cf3b9668c94350aef1d22af71604ddf95c845 (diff)
util: Make xmlconfig.c build on Solaris without d_type in dirent (v2)
v2: check for lstat() failing Fixes: 04bdbbcab3c "xmlconfig: read more config files from drirc.d/" Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Roland Mainz <roland.mainz@nrubsig.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--src/util/xmlconfig.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
index 5264f2598b4..5907c68012e 100644
--- a/src/util/xmlconfig.c
+++ b/src/util/xmlconfig.c
@@ -938,8 +938,16 @@ parseOneConfigFile(struct OptConfData *data, const char *filename)
static int
scandir_filter(const struct dirent *ent)
{
+#ifndef DT_REG /* systems without d_type in dirent results */
+ struct stat st;
+
+ if ((lstat(ent->d_name, &st) != 0) ||
+ (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)))
+ return 0;
+#else
if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
return 0;
+#endif
if (fnmatch("*.conf", ent->d_name, 0))
return 0;