From owner-freebsd-hackers Wed Mar 31 9:17:58 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (Postfix) with ESMTP id 9008214D32 for ; Wed, 31 Mar 1999 09:17:49 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id JAA49728; Wed, 31 Mar 1999 09:17:07 -0800 (PST) (envelope-from dillon) Date: Wed, 31 Mar 1999 09:17:07 -0800 (PST) From: Matthew Dillon Message-Id: <199903311717.JAA49728@apollo.backplane.com> To: Graham Wheeler Cc: Ladavac Marino , hackers@FreeBSD.ORG Subject: Re: select() on UDP socket returns ECONNREFUSED References: <97A8CA5BF490D211A94F0000F6C2E55D097583@s-lmh-wi-900.corpnet.at> <37020CE5.477F888D@cdsec.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :> 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message