OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: A question about read(2) in ntpd/bgpd

From: Henning Brauer (lists-openbsdtechbsws.de)
Date: Sun Mar 18 2007 - 14:05:45 CDT


* Valentin Kozamernik <tinkomna.com> [2007-03-18 16:25]:
> While reading through ntpd and bgpd sources I came across a piece of
> code I don't fully understand.
>
> The imsg_read() function uses read(2) and returns 0 on EOF, EINTR or
> EAGAIN. But whereever imsg_read() is used it is assumed that the
> return value of 0 means that the socket has been closed.

imsg_read actually uses recvmsg(2), but that doesn't really make a
difference.

you are correct insofar that the return(0) there is incorrect.
after looking at things a bit I believe we get away with returning -2
in that case, but I'll look a bit closer before actually changing that.

a very good catch!

--
Henning Brauer, hbbsws.de, henningopenbsd.org
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting - Hamburg & Amsterdam