Bug 69142

Summary: Include file /usr/include/dirent.h bug.
Product: [Retired] Red Hat Linux Reporter: Howard Dennison <howard_2_dennison>
Component: libcAssignee: Jakub Jelinek <jakub>
Status: CLOSED WORKSFORME QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-15 21:55:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Howard Dennison 2002-07-18 08:48:20 UTC
Description of Problem:
The enum statement in /usr/include/dirent.h is wrongly defined in that the 
enum statement has #define statements embedded in it.
The gcc and cc compilers won't accept this in my C source-code.
I moved the #define statements in front of the enum (See below) and everything 
works fine.
This is used when reading the filenames held in a directory from a C program.

Old dirent.h code ....
#ifdef __USE_BSD
/* File types for `d_type'.  */
enum
  {
    DT_UNKNOWN = 0,
# define DT_UNKNOWN     DT_UNKNOWN
    DT_FIFO = 1,
# define DT_FIFO        DT_FIFO
    DT_CHR = 2,
# define DT_CHR         DT_CHR
    DT_DIR = 4,
# define DT_DIR         DT_DIR
    DT_BLK = 6,
# define DT_BLK         DT_BLK
    DT_REG = 8,
# define DT_REG         DT_REG
    DT_LNK = 10,
# define DT_LNK         DT_LNK
    DT_SOCK = 12,
# define DT_SOCK        DT_SOCK
    DT_WHT = 14
# define DT_WHT         DT_WHT
  };

New dirent.h code......
#ifdef __USE_BSD
 
/* File types for `d_type'.  */
# define DT_UNKNOWN     DT_UNKNOWN
# define DT_FIFO        DT_FIFO
# define DT_CHR         DT_CHR
# define DT_DIR         DT_DIR
# define DT_BLK         DT_BLK
# define DT_REG         DT_REG
# define DT_LNK         DT_LNK
# define DT_SOCK        DT_SOCK
# define DT_WHT         DT_WHT
 
enum
  {
    DT_UNKNOWN = 0,
    DT_FIFO = 1,
    DT_CHR = 2,
    DT_DIR = 4,
    DT_BLK = 6,
    DT_REG = 8,
    DT_LNK = 10,
    DT_SOCK = 12,
    DT_WHT = 14
  };
This WORKS!!!!

            Regards, Howard.



Version-Release number of selected component (if applicable): Red Hat 7.1


How Reproducible:
Compile a C program that includes the file /usr/include/dirent.h using gcc or 
cc 


Steps to Reproduce:
1. 
2. 
3. 

Actual Results:
Compilations Fails.

Expected Results:


Additional Information:

Comment 1 Jakub Jelinek 2002-07-18 08:55:17 UTC
Err, can you clarify what's wrong on it (I don't see anything) and how a compiler
doesn't accept it (and on which testcase)?