svn commit: r225097 - in projects/ino64: include lib/libc/gen
usr.sbin/cpucontrol usr.sbin/lpr/common_source usr.sbin/newsyslog
Sergey Kandaurov
pluknet at freebsd.org
Thu Sep 1 15:59:35 UTC 2011
On 25 August 2011 01:14, Jilles Tjoelker <jilles at 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:
>> Avoid using dirfd name there is dirfd() macro already.
>> Use dirfd() instead of dirp->dd_fd.
>> Replace dirfd() macro with exported libc symbol.
>> Use _dirfd() macro internally.
>
>> GSoC r222835, r222836, r222837.
>> Code by Gleb Kurtsou.
>
>> Added: projects/ino64/lib/libc/gen/dirfd.c
>> ==============================================================================
>> --- /dev/null 00:00:00 1970 (empty, because file is newly added)
>> +++ projects/ino64/lib/libc/gen/dirfd.c Mon Aug 22 23:54:12 2011 (r225097)
> [snip]
>> +int
>> +dirfd(DIR *dirp)
>> +{
>> + if (dirp == NULL)
>> + return (-1);
>> +
>> + 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)
--
wbr,
pluknet
More information about the svn-src-projects
mailing list