Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jan 1999 13:36:53 +0100 (CET)
From:      Alexander Leidinger <netchild@wurzelausix.CS.Uni-SB.DE>
To:        bde@zeta.org.au
Cc:        current@FreeBSD.ORG
Subject:   Re: readdir & cd9660 & direntp->d_type == bug (more)
Message-ID:  <199901231238.NAA29562@wurzelausix>
In-Reply-To: <199901221132.WAA17787@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 22 Jan, Bruce Evans wrote:

>>/cdrom:
>>.                                        (type: unknown)
>>..                                       (type: unknown)
>>autorun.inf                              (type: unknown)
> 
> This is because the cd9660 file system doesn't implement d_type.

man dirent or man readdir didn`t note that it`s possible to have this
behavior.

>>#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

It compiles, output above.

> 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.

So it`s a bug, but in a different way I want. :(

Without _POSIX_SOURCE it didn`t work either.
Is it useless, because we can only say "it works _perhaps_" (and we
have to stat the entry), or is it a bug?

Bye,
Alexander.

-- 
http://netchild.home.pages.de     A.Leidinger @ wurzelausix.cs.uni-sb.de


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?199901231238.NAA29562>