Moinak Ghosh wrote:

> [EMAIL PROTECTED] wrote:
>
>> [...]
>>
>>> Strictly conformant to the above would therefore be:
>>>
>>> #define    dirfd(dp)    ((dp) ? (dp)->dd_fd : -1)
>>>     
>>
>>
>> No.  Nothing to do with strictly conformant; while it is possible
>> to have a DIR * which is NULL, using it immediately gets you undefined
>> behaviour.
>>
>> IMHO, implementations MUST NOT protect against that; that way madness
>> and buggy programs lie.
>>   
>
>
>   As a related note glibc has some questionable protections, like
> free(NULL)
>   which it simply ignores resulting in bugs remaining hidden. GNU ls
> does a
>   free(NULL) somewhere which we discovered while demoing truss on linux
>   processes in BrandZ. It is also visible when you use ltrace in Linux.
>
free(NULL) is a legal no-opp in C.

Ian
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to