summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qdnslookup_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-10-04 15:23:54 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-16 00:01:05 +0200
commit6c5e6a030dc49f36a5d4f2846fe78daf3d02a03d (patch)
tree0c40d34c80fca20dadaeb39e11e69241f7970cc2 /src/network/kernel/qdnslookup_unix.cpp
parent704616605b571f126bce59243c8bc3be48f5ace8 (diff)
Fix loading of libresolv when the .so file (not .so.2) isn't installed
glibc is nice to us and provides a #define with the actual name. On most Linux systems, the .so file is installed only if the glibc-devel package is installed. For all of us Qt developers, it's installed. But for end users, it might not be. Change-Id: Id455371db91a074befd3bcd071f285c725d7e7e5 Reviewed-by: Ian Monroe <imonroe@kde.org> Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/kernel/qdnslookup_unix.cpp')
-rw-r--r--src/network/kernel/qdnslookup_unix.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index 729729d929..052c492f07 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -52,6 +52,10 @@
#include <arpa/nameser_compat.h>
#include <resolv.h>
+#ifdef __GNU_LIBRARY__
+# include <gnu/lib-names.h>
+#endif
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_LIBRARY
@@ -77,9 +81,16 @@ struct QDnsLookupStateDeleter
static void resolveLibrary()
{
- QLibrary lib(QLatin1String("resolv"));
+ QLibrary lib;
+#ifdef LIBRESOLV_SO
+ lib.setFileName(QStringLiteral(LIBRESOLV_SO));
if (!lib.load())
- return;
+#endif
+ {
+ lib.setFileName(QLatin1String("resolv"));
+ if (!lib.load())
+ return;
+ }
local_dn_expand = dn_expand_proto(lib.resolve("__dn_expand"));
if (!local_dn_expand)