Copy from home:xwhu:Factory/stardict via accept of submit request 30767 revision 8. Request was accepted with message: Reviewed ok OBS-URL: https://build.opensuse.org/request/show/30767 OBS-URL: https://build.opensuse.org/package/show/Education/stardict?expand=0&rev=4
21 lines
820 B
Diff
21 lines
820 B
Diff
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;
|