[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: detection of functional openat() for usage inside getcwd.c
From: |
Jim Meyering |
Subject: |
Re: detection of functional openat() for usage inside getcwd.c |
Date: |
Mon, 17 Dec 2007 14:20:42 +0100 |
Petr Salinger <address@hidden> wrote:
>>> getcwd.c uses *at() function family iff AT_FDCWD is defined.
>>> This approach does not work on GNU/kFreeBSD - FreeBSD kernel + GNU libc.
>>> The kernel does not provide needed interfaces, and therefore glibc
>>> provides only stub version for function from *at() family.
>>> But the AT_FDCWD is declared and getcwd.c uses only native i.e. openat().
>>>
>>> Please, could you change detection whether really use *at() function
>>> family in getcwd.
>>
>> Here's an untested patch.
>> Please test it.
>>
>> Port to GNU/kFreeBSD - FreeBSD kernel + GNU libc,
>> which has no openat syscall, yet <fcntl.h> does define AT_FDCWD.
>> * lib/getcwd.c: Undef AT_FDCWD if there is no openat function.
>> * modules/getcwd (Depends-on): Add openat.
>> Reported by Petr Salinger.
>
> I slightly changed the patch, to be consistent with approach in lib/fts.c.
> It does work for GNU/kFreeBSD.
I considered doing that, but was dubious about institutionalizing
my prior use of HAVE_OPENAT_SUPPORT. However, it does make the code
more readable than continuing to use AT_FDCWD, so I've used your
patch with a small comment change:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=summary
Thanks.