Skip to content

Commit

Permalink
tst_QDnsLookup: don't add duplicate 'nameserver' lines
Browse files Browse the repository at this point in the history
I don't know why systemd-resolved did have those for me, but it did, so
QtTest complains.

QWARN  : tst_QDnsLookup::setNameserver() Duplicate data tag "..." - please rename.

Pick-to: 6.8
Change-Id: I8df70eb429682b529ecefffd0aca735f94d77225
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
  • Loading branch information
thiagomacieira committed Oct 2, 2024
1 parent 41768db commit 1420ee8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ static QList<QHostAddress> systemNameservers(QDnsLookup::Protocol protocol)
if (!line.startsWith(command))
continue;

QString addr = QLatin1StringView(line).mid(sizeof(command));
result.emplaceBack(addr);
QHostAddress addr(QLatin1StringView(line).mid(sizeof(command)));
if (!result.contains(addr))
result.emplaceBack(std::move(addr));
}
};
parseFile("/etc/resolv.conf"_L1);
Expand Down

0 comments on commit 1420ee8

Please sign in to comment.