Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

credis_connect() calls gethostbyname(), which is not reentrant #29

Closed
GoogleCodeExporter opened this issue Nov 3, 2015 · 6 comments
Closed

Comments

@GoogleCodeExporter
Copy link

Line 715 in credis_connect() calls gethostbyname() which is not reentrant.  
gethostbyname_r() is reentrant.  Also note that both of the gethostbyname() 
calls are deprecated, replaced with getnameinfo().

Original issue reported on code.google.com by deanwba...@gmail.com on 15 Sep 2010 at 12:00

@GoogleCodeExporter
Copy link
Author

I can take a stab at a patch later in the week if it helps.

Cheers.

Original comment by deanwba...@gmail.com on 15 Sep 2010 at 12:18

@GoogleCodeExporter
Copy link
Author

Ooops I missed that lots of people ask me if credis is thread safe and I've 
told them yes, it should be... I reused an old snippet when starting on Credis 
so I will gladly accept a patch that fixes this issue.

cheers, 
Jonas

Original comment by romf...@gmail.com on 15 Sep 2010 at 7:41

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Question--

gethostbyname() is only called in the event that inet_aton(host, &sa.sin_addr) 
fails.  On my system, it doesn't fail, so I haven't had any issues with thread 
safety.  My question is:  When would inet_aton fail that gethostbyname() would 
succeed?

Cheers,

Dean

Original comment by deanwba...@gmail.com on 15 Sep 2010 at 9:58

@GoogleCodeExporter
Copy link
Author

This should do it for the non-Win build.  I did not check the Win side, but I 
don't think I broke anything.  Shout if I messed up--still learning the ropes...

Cheers,

Dean

Original comment by deanwba...@gmail.com on 18 Sep 2010 at 1:14

Attachments:

@GoogleCodeExporter
Copy link
Author

thanks, I have taken your patch with minor changes

Original comment by romf...@gmail.com on 21 Sep 2010 at 12:34

@GoogleCodeExporter
Copy link
Author

Original comment by romf...@gmail.com on 21 Sep 2010 at 12:34

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant