Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 1999 22:32:55 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        current@FreeBSD.ORG, netchild@wurzelausix.CS.Uni-SB.DE
Subject:   Re: readdir & cd9660 & direntp->d_type == bug (more)
Message-ID:  <199901221132.WAA17787@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>attached is the source of a test program.
>
>With the CD of my ISDN card it produces:
>
>{0} <FreeBSD 4.0-CURRENT>
>(15) netchild@ttyp1 > ./dirtest /cdrom
>
>/cdrom:
>.                                        (type: unknown)
>..                                       (type: unknown)
>autorun.inf                              (type: unknown)

This is because the cd9660 file system doesn't implement d_type.

>{0} <FreeBSD 4.0-CURRENT>
>(16) netchild@ttyp1 > ls -l /cdrom
>total 173
>-r-xr-xr-x  1 root  wheel     54 22 Mai  1998 autorun.inf

ls works because it stats the file.

>#define _POSIX_SOURCE
>
>#include <sys/types.h>
>#include <dirent.h>
>...
>  while((dent_p = readdir(dir_p)))
>  {
>    printf("%-40s (type: %s)\n", dent_p->d_name, types[dent_p->d_type]);
>  }

This probably shouldn't compile, since d_type isn't in POSIX.1.  POSIX.1
only guarantees d_name in struct dirent.  Names beginning with d_ are
reserved for use in <dirent.h>, but FreeBSD normally attempts to give
strict POSIX.1 if _POSIX_SOURCE is defined.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901221132.WAA17787>