[Pcsclite-git-commit] [PCSC] 06/06: Fix use of d_type field on SunOS

Ludovic Rousseau rousseau at moszumanska.debian.org
Sun Apr 24 17:08:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository PCSC.

commit fa52ae4e1f1ae3c35596e9aedaa3ce30fc5ceef9
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sun Apr 24 19:04:04 2016 +0200

    Fix use of d_type field on SunOS
    
    SunOS does not provide the d_type field in a directory entry.
    
    The code now checks that d_type is available using
    AC_STRUCT_DIRENT_D_TYPE and use it conditionnaly.
    
    Fix compilation error on SunOS:
    configfile.l: In function 'DBGetReaderListDir':
    configfile.l:293:16: error: 'struct dirent' has no member named 'd_type'
        if (direntry->d_type == DT_UNKNOWN)
                    ^
    configfile.l:293:28: error: 'DT_UNKNOWN' undeclared (first use in this function)
        if (direntry->d_type == DT_UNKNOWN)
                                ^
    configfile.l:293:28: note: each undeclared identifier is reported only once for each function it appears in
    configfile.l:312:17: error: 'struct dirent' has no member named 'd_type'
         if (direntry->d_type != DT_REG)
                     ^
    configfile.l:312:29: error: 'DT_REG' undeclared (first use in this function)
         if (direntry->d_type != DT_REG)
                                 ^
    
    Thanks to risto3 for the bug report
    https://github.com/LudovicRousseau/PCSC/issues/6
---
 configure.ac     | 1 +
 src/configfile.l | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 487b8ad..a99ad24 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,7 @@ AC_C_CONST
 AC_TYPE_UID_T
 AC_TYPE_SIZE_T
 AC_HEADER_TIME
+AC_STRUCT_DIRENT_D_TYPE
 
 # Checks for library functions
 AC_FUNC_ERROR_AT_LINE
diff --git a/src/configfile.l b/src/configfile.l
index 124e524..4e34ada 100644
--- a/src/configfile.l
+++ b/src/configfile.l
@@ -290,7 +290,9 @@ int DBGetReaderListDir(const char *readerconf_dir,
 				readerconf_dir, direntry->d_name);
 
 			/* skip non regular files */
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
 			if (direntry->d_type == DT_UNKNOWN)
+#endif
 			{
 				struct stat st;
 
@@ -309,7 +311,9 @@ int DBGetReaderListDir(const char *readerconf_dir,
 				}
 			}
 			else
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
 				if (direntry->d_type != DT_REG)
+#endif
 				{
 					Log2(PCSC_LOG_DEBUG, "Skipping non regular file: %s",
 						direntry->d_name);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git



More information about the Pcsclite-cvs-commit mailing list