This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 69142 - Include file /usr/include/dirent.h bug.
Include file /usr/include/dirent.h bug.
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: libc (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-07-18 04:48 EDT by Howard Dennison
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 16:55:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Howard Dennison 2002-07-18 04:48:20 EDT
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 04:55:17 EDT
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)?

Note You need to log in before you can comment on or make changes to this bug.