On Wed, 2006-Aug-16 15:54:25 -0700, Micah wrote:
>I think you could fake it as follows:
>
>struct dirent {
>        __uint32_t d_fileno;            /* file number of entry */
>        __uint16_t d_reclen;            /* length of this record */
>        __uint8_t  d_type;              /* file type, see below */
>        __uint8_t  d_namlen;            /* length of string in d_name */
>#define MAXNAMLEN 255
>        char    d_name[MAXNAMLEN + 1];  /* name must be no longer than 
>this */
>#if !__BSD_VISIBLE
>#undef MAXNAMLEN
>#endif
>};

Macro definitions don't nest so this isn't safe.  Consider some code that
does:

#define MAXNAMLEN       1024
...
#include <sys/dirent.h>
...
char    mybuffer[MAXNAMLEN];

-- 
Peter Jeremy

Attachment: pgp9G71sqx9ME.pgp
Description: PGP signature

Reply via email to