From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 17 08:40:47 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 143A916A4DD for ; Thu, 17 Aug 2006 08:40:47 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.FreeBSD.org (Postfix) with ESMTP id D413443D4C for ; Thu, 17 Aug 2006 08:40:45 +0000 (GMT) (envelope-from peterjeremy@optushome.com.au) Received: from turion.vk2pj.dyndns.org (c220-239-19-236.belrs4.nsw.optusnet.com.au [220.239.19.236]) by mail02.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id k7H8ebZ3022757 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 17 Aug 2006 18:40:43 +1000 Received: from turion.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by turion.vk2pj.dyndns.org (8.13.6/8.13.6) with ESMTP id k7H8ebdZ001044; Thu, 17 Aug 2006 18:40:37 +1000 (EST) (envelope-from peter@turion.vk2pj.dyndns.org) Received: (from peter@localhost) by turion.vk2pj.dyndns.org (8.13.6/8.13.6/Submit) id k7H8eaKm001043; Thu, 17 Aug 2006 18:40:36 +1000 (EST) (envelope-from peter) Date: Thu, 17 Aug 2006 18:40:36 +1000 From: Peter Jeremy To: Micah Message-ID: <20060817084036.GC845@turion.vk2pj.dyndns.org> References: <44E29055.3080205@centtech.com> <20060816054925.GA11651@droopy.unibe.ch> <44E3484D.8090905@centtech.com> <44E39DEC.1050204@uts.edu.au> <44E3A221.1070905@ywave.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6zdv2QT/q3FMhpsV" Content-Disposition: inline In-Reply-To: <44E3A221.1070905@ywave.com> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.12-2006-07-14 Cc: FreeBSD Hackers Subject: Re: struct dirent question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 08:40:47 -0000 --6zdv2QT/q3FMhpsV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=20 >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 =2E.. #include =2E.. char mybuffer[MAXNAMLEN]; --=20 Peter Jeremy --6zdv2QT/q3FMhpsV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFE5CuE/opHv/APuIcRAmVJAKCq8Fww4zhaASi+MUa5yHob4m8eYwCfT/Yq NKjcZ4AQMoGPOJ+Rgdcarp8= =7TgC -----END PGP SIGNATURE----- --6zdv2QT/q3FMhpsV--