Re: [Sqlrelay-discussion] a bug exists in the rudiments
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2006-08-05 04:36:49
|
Thanks for finding that.
It looks like the code should be replaced with:
// get the address info for the given address/port
addrinfo *ai;
int result;
do {
result=getaddrinfo(_address(),portstr,&hints,&ai);
} while (result==EAI_SYSTEM && error::getErrorNumber()==EINTR);
delete[] portstr;
if (result) {
return RESULT_ERROR;
}
getaddrinfo always returns 0 on success and returns EAI_SYSTEM on a
system error like EINTR.
I'll make sure to fix this in the next release.
Dave
On Wed, 2006-08-02 at 16:43 +0900, seong hoon park wrote:
> In the file src/inetclientsocket.C:145
>
> do {
>
> result=getaddrinfo(_address(),portstr,&hints,&ai);
> } while (result==-1 &&
> error::getErrorNumber()==EINTR);
> delete[] portstr;
> if (result==-1) {
> return RESULT_ERROR;
> }
>
> but return value of getaddraddrinfo() is not only -1 if failed
>
> line 196:
> for (addrinfo *ainfo=ai; ainfo; ainfo=ainfo->ai_next) {
>
> If target hostname doesn't exists ( in my system, getaddrinfo()
> returns -2)
> segmentation fault can occur here as it haven't returned
> with RESULT_ERROR ( I build it with efence library)
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________ Sqlrelay-discussion mailing list Sql...@li... https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
|