OSDN Git Service

construct QFile with the filename in QHostInfo::localDomainName()
authorIvailo Monev <xakepa10@laimg.moc>
Mon, 29 Jul 2019 10:41:38 +0000 (10:41 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Mon, 29 Jul 2019 10:41:38 +0000 (10:41 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/network/kernel/qhostinfo_unix.cpp

index 1601091..6d7756b 100644 (file)
@@ -301,11 +301,10 @@ QString QHostInfo::localDomainName()
 #else
 
     // nothing worked, try doing it by ourselves:
-    QFile resolvconf;
 #if defined(_PATH_RESCONF)
-    resolvconf.setFileName(QFile::decodeName(_PATH_RESCONF));
+    QFile resolvconf(QFile::decodeName(_PATH_RESCONF));
 #else
-    resolvconf.setFileName(QLatin1String("/etc/resolv.conf"));
+    QFile resolvconf(QLatin1String("/etc/resolv.conf"));
 #endif
     if (!resolvconf.open(QIODevice::ReadOnly))
         return QString();       // failure