Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Feb 1999 16:17:32 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        nsmart@kira.team400.ie
Cc:        hackers@FreeBSD.ORG
Subject:   Re: select() can set errno to ECHILD?
Message-ID:  <199902160017.QAA52267@vashon.polstra.com>
In-Reply-To: <36C85A77.EDBC00F9@kira.team400.ie>
References:  <19990215015534.A20671@oss.uswest.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <36C85A77.EDBC00F9@kira.team400.ie>,
Niall Smart  <nsmart@kira.team400.ie> wrote:
> Erik E Rantapaa wrote:
> > 
> > I have code running under 2.2.x which claims that this is happening.
> > This behaviour is not documented in the man pages.  I have not been able to
> > duplicate it in a simple test program I wrote, but the log files for
> > a Merit RADIUS server say that it is happening.
> > 
> > Is this at all possible?
> 
> You are getting SIGCHLD while blocked in select, waitpid with WNOHANG in
> then handler returns ECHILD, the signal handler fails to restore errno.

But when the signal handler returns, it will return to select()
again, right?  And select will either continue and eventually succeed
returning some number >= 0, or it will itself set errno (perhaps to
EINTR) and return -1, right?  So if the caller of select checks its
return value and only looks at errno if the return value is -1, I
can't see how anything the signal handler does could confuse it.

In other words, if there is a bug in the application then it must be
that the application fails to check the return value of select before
examining errno.

John
-- 
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Nobody ever went broke underestimating the taste of the American public."
                                                            -- H. L. Mencken

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902160017.QAA52267>