lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] errno is not set in sockets.c


From: address@hidden
Subject: Re: [lwip-users] errno is not set in sockets.c
Date: Tue, 20 Mar 2012 21:33:39 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20120313 Thunderbird/11.0

Kieran Mansley wrote:
On 20 Mar 2012, at 09:53, Mason wrote:

Looking at sockets.c, the relevant code is:

#ifdef ERRNO
#ifndef set_errno
#define set_errno(err) errno = (err)
#endif
#else /* ERRNO */
#define set_errno(err)
#endif /* ERRNO */
I suspect that it might be something relevant to Windows ports.  I can't see a 
problem with the change you suggest, but I'd like to understand what this was 
for in the first place as I'm cautious when it comes to things that require 
changes to the ports - we need to have a good reason for them.

I don't think it's a Windows port thing: it's not defined in the windows port plus it compiles correctly with or without ERRNO being defined. It's odd though that it's not defined: I have written code (in contrib/apps/socket_examples) that uses 'errno' to assert things (and successfully used it for testing nonblocking sockets) but it obviously doesn't run without that define... :-/

I do know that I've just added the '#ifndef set_errno' 2 years ago, so the '#ifdef ERRNO' was probably the only way to *not* use 'errno' before that.

Personally, I think it's correct that we do not change 'errno' without explicitly enabling it: we don't want to mess with C library code that uses 'errno' by default.

Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]