components/pcsc-lite/patches/02-configfile.c.patch
changeset 6133 73641150a4de
equal deleted inserted replaced
6132:7fb35b7d3c4d 6133:73641150a4de
       
     1 In-house patch created for studio compiler and userland build environment.
       
     2 This is similar to upstream patch for missing d_type field on SunOS.
       
     3 
       
     4 This patch is Solaris buildenv specific and may not be suitable for upstream.
       
     5 
       
     6 --- pcsc-lite-1.8.14/src/configfile.c	2015-04-29 15:23:11.000000000 -0400
       
     7 +++ pcsc-lite-1.8.14/src/configfile.c	2016-05-05 16:41:12.704546283 -0400
       
     8 @@ -2012,37 +2012,28 @@
       
     9  		while ((direntry = readdir(dir)) != NULL)
       
    10  		{
       
    11  			char filename[FILENAME_MAX];
       
    12 +			struct stat st;		
       
    13  			int r;
       
    14  
       
    15  			snprintf(filename, sizeof(filename), "%s/%s",
       
    16  				readerconf_dir, direntry->d_name);
       
    17  
       
    18  			/* skip non regular files */
       
    19 -			if (direntry->d_type == DT_UNKNOWN)
       
    20 -			{
       
    21 -				struct stat st;
       
    22  
       
    23 -				if (lstat(filename, &st) != 0)
       
    24 -				{
       
    25 -					Log2(PCSC_LOG_DEBUG, "Skipping non statable file: %s",
       
    26 -						direntry->d_name);
       
    27 -					continue;
       
    28 -				}
       
    29  
       
    30 -				if (!S_ISREG(st.st_mode))
       
    31 -				{
       
    32 -					Log2(PCSC_LOG_DEBUG, "Skipping non regular file: %s",
       
    33 +			if (lstat(direntry->d_name, &st) != 0)
       
    34 +			{
       
    35 +
       
    36 +				Log2(PCSC_LOG_DEBUG, "Skipping non regular file: %s",
       
    37  						direntry->d_name);
       
    38 -					continue;
       
    39 -				}
       
    40 +				continue;
       
    41  			}
       
    42 -			else
       
    43 -				if (direntry->d_type != DT_REG)
       
    44 -				{
       
    45 -					Log2(PCSC_LOG_DEBUG, "Skipping non regular file: %s",
       
    46 -						direntry->d_name);
       
    47 -					continue;
       
    48 -				}
       
    49 +			if (!S_ISREG(st.st_mode))
       
    50 +                        {
       
    51 +                                Log2(PCSC_LOG_DEBUG, "Skipping non regular file: %s",
       
    52 +                                       direntry->d_name);
       
    53 +                                continue;
       
    54 +                        }
       
    55  
       
    56  			/* skip files starting with . like ., .., .svn, etc */
       
    57  			if ('.' == direntry->d_name[0])