On 03/20/2013 04:28 PM, Paul Eggert wrote:
> On 03/20/13 03:38, Arno Onken wrote:
>> The following code in opendir.c silences cppcheck:
>>
>> {{{
>> #if !defined(HAVE_OPENDIR) && defined(REPLACE_FCHDIR)
>> #error Invalid configuration!!
>> #endif
>> }}}
>
> It may silence cppcheck, but I'm afraid I don't see why it's
> correct or needed. Can you explain the error scenario
> in more detail?
It is explained in the second post on the bug tracker:
Comment(by amai):
Well, I am just looking at lib/opendir.c - and I have no idea about the
correlation of involved macros ''HAVE_OPENDIR'' and ''REPLACE_FCHDIR'' ...
So ''ifndef HAVE_OPENDIR'' and ''#ifdef REPLACE_FCHDIR'' cppcheck is
right, ''dirp'' is allocated by ''malloc()'' and passed to ''closedir()''.