From owner-freebsd-current Fri Jan 22 03:33:17 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA28086 for freebsd-current-outgoing; Fri, 22 Jan 1999 03:33:17 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.26.10.9]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA28081 for ; Fri, 22 Jan 1999 03:33:14 -0800 (PST) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id WAA17787; Fri, 22 Jan 1999 22:32:55 +1100 Date: Fri, 22 Jan 1999 22:32:55 +1100 From: Bruce Evans Message-Id: <199901221132.WAA17787@godzilla.zeta.org.au> To: current@FreeBSD.ORG, netchild@wurzelausix.CS.Uni-SB.DE Subject: Re: readdir & cd9660 & direntp->d_type == bug (more) Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >attached is the source of a test program. > >With the CD of my ISDN card it produces: > >{0} >(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} >(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 >#include >... > 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 , 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