[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: select() on UDP socket returns ECONNREFUSED
From:       Matthew Dillon <dillon () apollo ! backplane ! com>
Date:       1999-03-31 17:17:07
[Download RAW message or body]

:>         Do you mean, select returns -1 and sets errno to ECONNREFUSED?
:
:Oops (hides head in embarassment). I just checked the code (which 
:wasn't mine) and saw that the error gets logged if the select returns
:something other than 1 and errno isn't EINTR. Which means that this is
:happening when the select times out and returns zero.
:
:Turns out the person who wrote the code erroneously assumed that
:select() would return errno==EINTR if it timed out.
: 
:-- 
:Dr Graham Wheeler                          E-mail: gram@cdsec.com
:Citadel Data Security                      Phone:  +27(21)423-6065/6/7
:Firewalls/Virtual Private Networks         Fax:    +27(21)24-3656
:Internet/Intranet Network Specialists      
:Data Security Products                     WWW:    http://www.cdsec.com/

    People should remember that system calls do *NOT* clear errno.  If
    errno is set from a previous error, it stays set even if the system
    call succeeds.

    Also, system and library routines do not reliably overwrite errno if
    errno is non-zero prior to making the call.  If you intend to check
    errno after a library or system call returns < 0, you have clear 
    errno prior to making the call or you may get stale data.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic