On Thu, Jan 6, 2011 at 6:33 PM, Mike Blumenkrantz <[email protected]> wrote:
> On Thu, 06 Jan 2011 07:21:18 +0100
> Sebastian Dransfeld <[email protected]> wrote:
>
>> On 01/05/2011 09:18 PM, Lucas De Marchi wrote:
>> >> +              if (errno)
>> >
>> > This is bad... you have to either zero errno before calling open() or check
>> > the return value before. Since open() will not zero errno in case of
>> > succees, doing like you did you're actually carrying whatever value errno
>> > had.
>>
>> Should users always zero errno before checking? Then this needs to be
>> checked throughout efl. I remember a while ago someone actually removed
>> errno = 0 in some code.
>>
>> Sebastian
>>
> Yes, I remember someone removing the errno checks as well.  According to the
> man page, however, you must set it to 0 before you check it to receive valid
> results, so I would guess that this is indeed something that should be 
> verified
> throughout the codebase.
>
> Perhaps a good opportunity for a cocci script? :)

Nah, that's wrong also, errno only mean something if open return a fd
< 0, all other case are not defined. Before checking errno for any
syscall, you need to first check if the syscall failed.
-- 
Cedric BAIL

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to