File fix_gethostbynamer.patch of Package stardict
Index: stardict-3.0.1/src/lib/sockets.cpp
===================================================================
--- stardict-3.0.1.orig/src/lib/sockets.cpp 2007-09-12 17:11:41.000000000 +0800
+++ stardict-3.0.1/src/lib/sockets.cpp 2009-01-13 16:29:18.000000000 +0800
@@ -162,9 +162,12 @@
struct hostent hostinfo;
char buf[1024];
int ret;
- if (!gethostbyname_r(query_data->host.c_str(), &hostinfo, buf,
- sizeof(buf), &phost, &ret)) {
- query_data->sa = ((in_addr*)(hostinfo.h_addr))->s_addr;
+
+ gethostbyname_r(query_data->host.c_str(), &hostinfo, buf,
+ sizeof(buf), &phost, &ret);
+
+ if (ret == 0 && phost != NULL) {
+ query_data->sa = ((in_addr*)(hostinfo.h_addr))->s_addr;
query_data->resolved = true;
} else {
query_data->resolved = false;