179894
Changes specific to RHEL-8:
179894
179894
- lstat64 is a macro, so undefine it first
179894
179894
commit f3629a4be82a393ff56646c388da2fda0101f557
179894
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
179894
Date:   Thu Jun 10 14:56:37 2021 +0530
179894
179894
    Handle DT_UNKNOWN in gconv-modules.d
179894
    
179894
    On filesystems that do not support dt_type, a regular file shows up as
179894
    DT_UNKNOWN.  Fall back to using lstat64 to read file properties in
179894
    such cases.
179894
    
179894
    Reviewed-by: DJ Delorie <dj@redhat.com>
179894
179894
diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
179894
index 3d4d58d4be10a250..ba9b3fd36d9e30f9 100644
179894
--- a/iconv/gconv_parseconfdir.h
179894
+++ b/iconv/gconv_parseconfdir.h
179894
@@ -32,6 +32,8 @@
179894
 # define readdir __readdir
179894
 # define closedir __closedir
179894
 # define mempcpy __mempcpy
179894
+# undef lstat64
179894
+# define lstat64 __lstat64
179894
 #endif
179894
 
179894
 /* Name of the file containing the module information in the directories
179894
@@ -138,7 +140,7 @@ gconv_parseconfdir (const char *dir, size_t dir_len)
179894
       struct dirent *ent;
179894
       while ((ent = readdir (confdir)) != NULL)
179894
 	{
179894
-	  if (ent->d_type != DT_REG)
179894
+	  if (ent->d_type != DT_REG && ent->d_type != DT_UNKNOWN)
179894
 	    continue;
179894
 
179894
 	  size_t len = strlen (ent->d_name);
179894
@@ -148,8 +150,14 @@ gconv_parseconfdir (const char *dir, size_t dir_len)
179894
 	      && strcmp (ent->d_name + len - strlen (suffix), suffix) == 0)
179894
 	    {
179894
 	      char *conf;
179894
+	      struct stat64 st;
179894
 	      if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0)
179894
 		continue;
179894
+	      if (ent->d_type == DT_UNKNOWN
179894
+		  && (lstat64 (conf, &st) == -1
179894
+		      || !S_ISREG (st.st_mode)))
179894
+		continue;
179894
+
179894
 	      found |= read_conf_file (conf, dir, dir_len);
179894
 	      free (conf);
179894
 	    }