Commit 066850ed authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ian Romanick
Browse files

util: Make xmlconfig.c build on Solaris without d_type in dirent (v2)

v2: check for lstat() failing

Fixes: 04bdbbca

 "xmlconfig: read more config files from drirc.d/"
Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Roland Mainz's avatarRoland Mainz <roland.mainz@nrubsig.org>
Reviewed-by: default avatarIan Romanick <ian.d.romanick@intel.com>
parent 084cf3b9
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment