Paolo Bonzini <pbonz...@redhat.com> writes: > On 28/06/2017 07:51, Markus Armbruster wrote: >>> The gethostbyname() return a null pointer if an error occurs, and the >>> h_errno >>> variable holds an error number. herror() and hstrerror() can prints the >>> error >>> message associated with the current value of h_errno, but hstrerror() >>> returns >>> the string type is good for passing the error message to Error. So I'd >>> prefer >>> the hstrerror. >>> >>> As for the portability of hstrerror(), sorry, I'm also not sure, but in this >>> case I tested, it's OK. so I want to use hstrerror() for a while, if there >>> are >>> any problem that can be fixed later. Do you think it can be done? >> >> Standard first portability question: does Windows provide it? > > Nope. But it does have gai_strerror.
Let's go with the generic error message I suggested, and leave adding detail to the patch that converts to getaddrinfo().