From owner-freebsd-standards@FreeBSD.ORG Sat Jan 25 01:29:36 2014 Return-Path: Delivered-To: freebsd-standards@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AEFD08D0 for ; Sat, 25 Jan 2014 01:29:36 +0000 (UTC) Received: from secure.xzibition.com (secure.xzibition.com [173.160.118.92]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 53D0C1E69 for ; Sat, 25 Jan 2014 01:29:36 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=shatow.net; h=date:from:to :cc:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=sweb; b=ObeFlSIJYncf0ERgbM6yDtBMn6RAtGjzQ FPlQXRQCeXEfzTfOSTqMvVlAd/kjZMhbqgTNpJXqDdC+n4MkxuCAYIhNhFKn49dD FgJIkyGqTJheqZW7ygwoJbFa2FqjTYccWA5pYtyT7KqWSEaf5Qho0dQboOjh7pNi GOuFfUvkTo= DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=shatow.net; h=date:from :to:cc:subject:message-id:references:mime-version:content-type :in-reply-to; s=sweb; bh=K2hY2G/AnHEuOOBCrOZ5jQkDxcR7IuYf286mqaF xaEs=; b=jpYuck2cFWccD0NlNIN5gXGRPsZUKcgDbeR3GuI71LMgAWxdEeIMhJ9 2bq4XjzWxWw/oAEH1CzsmsZzsVgrnBmY5lImkmUsSc8dwOg9kPr8W8a6Et5PHt/h rW6Uh6vy9t4QhY2qZAmw7u953HJ7aUyxlcBTsuadGwCM72nxQo5M= Received: (qmail 77820 invoked from network); 24 Jan 2014 19:29:34 -0600 Received: from unknown (HELO admin.xzibition.com) (bryan@shatow.net@173.160.118.90) by sweb.xzibition.com with ESMTPA; 24 Jan 2014 19:29:34 -0600 Date: Fri, 24 Jan 2014 19:29:32 -0600 From: Bryan Drewery To: Jilles Tjoelker Subject: Re: closedir(3) handling NULL Message-ID: <20140125012932.GD73838@admin.xzibition.com> References: <20140124014105.GC37334@admin.xzibition.com> <20140124132435.GA90996@stack.nl> <20140124165509.GA73838@admin.xzibition.com> <20140125041504.Y986@besplex.bde.org> <20140124213404.GC73838@admin.xzibition.com> <20140124223918.GA97844@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SFyWQ0h3ruR435lw" Content-Disposition: inline In-Reply-To: <20140124223918.GA97844@stack.nl> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: bapt@FreeBSD.org, freebsd-standards@FreeBSD.org X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 01:29:36 -0000 --SFyWQ0h3ruR435lw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 24, 2014 at 11:39:18PM +0100, Jilles Tjoelker wrote: > On Fri, Jan 24, 2014 at 03:34:04PM -0600, Bryan Drewery wrote: > > On Sat, Jan 25, 2014 at 06:00:08AM +1100, Bruce Evans wrote: > > > On Fri, 24 Jan 2014, Bryan Drewery wrote: > > > > I do think that improving portability is important. Even against > > > > sloppy coding. Applications developed for Linux are fine passing > > > > NULL to closedir(3), which leads to a style of coding that does > > > > not reveal itself to be a problem on FreeBSD until an edge case > > > > comes up. >=20 > > > This unimproves portability. FreeBSD intentionally does the > > > opposite for fclose(): from fclose(3): >=20 > > IMHO we should handle NULL gracefully in all places instead of having > > hidden surprises. >=20 > In many cases (but possibly not this one), handling NULL "gracefully" > makes it harder to debug the inevitable failure. For example, if > readdir() did not crash when passed a null pointer, a program that fails > to check opendir()'s return value would plough on for longer and it > would be harder to find the problem. >=20 > Whether a function that frees something silently does nothing when > passed a null pointer is indeed inconsistent. This argument makes sense to me. Stating the obvious, it's unfortunate that POSIX leaves some behavior undef= ined that leads to these inconsistencies between systems. >=20 > --=20 > Jilles Tjoelker > _______________________________________________ > freebsd-standards@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-standards > To unsubscribe, send any mail to "freebsd-standards-unsubscribe@freebsd.o= rg" --SFyWQ0h3ruR435lw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQJ8BAEBCgBmBQJS4xN8XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQzNkZFQkU5OTJGNTI4MERGNDgxMTM2MkE2 RTc4MkFDMDNDOUIwQ0Y5AAoJEG54KsA8mwz5sV4P/iiOf4w8vbkIy760kwjIQKDl oViICQsLTcHFu0HwSZaL/Gbg7O83pJQjxw8/oXCg4O3YhBxgmhEyOH7UFnE9wxKe +Sjd646xLhI/h9l4HDn4Tf0YsFoa+OINllNgakmuZry1v8+GwbMu38P0hXhgF8RR CPepPLgCDsWVXfnNnHwSiYMrVd8oCRRPSsgIX6fgwEudRIThzYdJBaRomUbzy5sG nNySRHZqShx5daVw3QszBaHEl/4OA2FdqSP66UZaT7i8f4JFRu3tbYWavkGSkQwp GCjRS/coOX0nzASansT9LqEhr4oQFSJQNYLI7hfVs7BCjQHCqOKU3l0r1DZUlx2O FcxXmcBEXdeRZfYQeq0787MvwJUf4Nrkxrghk4Di7+w97Fy3M9cDRcNIw9skwF8D dDrYUE4JnPrmW0eZBWLqt3RdRnIyJUV3d4FFvPPNHNfZRnkAP6XMZ3Ak3q2b+ghp 3iMPnBGIm3d25oR5ql4EVUU/xfKCcoWKAO+ZEuOLBOltEQxKeWGAasMKQyTvNIBy MKjxFmn3E9aLPfEqPhsd4wCY6uhRsTmu41Fg3+kcCqxz5h9VTH1skX7YFEZ72FED I5AECfDK47uYR43nOnSrL1RPy4odSnf6E+XqpankEoAnzKlGkh1ILwbe4UUiu/i0 GzeQNrnhWogQADAvKsKk =lcLW -----END PGP SIGNATURE----- --SFyWQ0h3ruR435lw--