Date: Thu, 1 Sep 2011 19:32:06 +0400 From: Sergey Kandaurov <pluknet@freebsd.org> To: Jilles Tjoelker <jilles@stack.nl> Cc: svn-src-projects@freebsd.org, gk@freebsd.org, src-committers@freebsd.org, Matthew D Fleming <mdf@freebsd.org> Subject: Re: svn commit: r225097 - in projects/ino64: include lib/libc/gen usr.sbin/cpucontrol usr.sbin/lpr/common_source usr.sbin/newsyslog Message-ID: <CAE-mSOJOEQu0ejqGd47iAG4z4_GUzhizu1d1-aJR=V8iyNohwQ@mail.gmail.com> In-Reply-To: <20110824211427.GB96070@stack.nl> References: <201108222354.p7MNsC9B074753@svn.freebsd.org> <20110824211427.GB96070@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On 25 August 2011 01:14, Jilles Tjoelker <jilles@stack.nl> wrote: > On Mon, Aug 22, 2011 at 11:54:12PM +0000, Matthew D Fleming wrote: >> Author: mdf >> Date: Mon Aug 22 23:54:12 2011 >> New Revision: 225097 >> URL: http://svn.freebsd.org/changeset/base/225097 > >> Log: >> =A0 Avoid using dirfd name there is dirfd() macro already. >> =A0 Use dirfd() instead of dirp->dd_fd. >> =A0 Replace dirfd() macro with exported libc symbol. >> =A0 Use _dirfd() macro internally. > >> =A0 GSoC r222835, r222836, r222837. >> =A0 Code by Gleb Kurtsou. > >> Added: projects/ino64/lib/libc/gen/dirfd.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- /dev/null 00:00:00 1970 =A0 (empty, because file is newly added) >> +++ projects/ino64/lib/libc/gen/dirfd.c =A0 =A0 =A0 Mon Aug 22 23:54:12 = 2011 =A0 =A0 =A0 =A0(r225097) > [snip] >> +int >> +dirfd(DIR *dirp) >> +{ >> + =A0 =A0 if (dirp =3D=3D NULL) >> + =A0 =A0 =A0 =A0 =A0 =A0 return (-1); >> + >> + =A0 =A0 return (_dirfd(dirp)); >> +} > > Why have this check here? I think the original behaviour (a segfault) is > more useful here since the return value of this interface is often not > checked. > Why not to convert it to EINVAL? As per IEEE Std 1003.1-2008: The dirfd() function may fail if: [EINVAL] The dirp argument does not refer to a valid directory stream. P.S. It seems autoconf expects dirfd() to be a function and fails if that's a macro (found when trying to build openssh-portable) --=20 wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOJOEQu0ejqGd47iAG4z4_GUzhizu1d1-aJR=V8iyNohwQ>