QLibrary: remove the unnecessary parentheses around dlerror()

We don't need a message like:

"Cannot load library nosuchlib: (nosuchlib: cannot open shared object file: No such file or directory)"

Change-Id: I01ec3c774d9943adb903fffd17b76599cea47502
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit a6a56814702612d8981f594a6158d70a7928cb99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2024-02-26 12:18:14 +01:00 committed by Qt Cherry-pick Bot
parent 8007f6acb1
commit 244618c19a

View File

@ -25,12 +25,6 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals; using namespace Qt::StringLiterals;
static QString qdlerror()
{
const char *err = dlerror();
return err ? u'(' + QString::fromLocal8Bit(err) + u')' : QString();
}
QStringList QLibraryPrivate::suffixes_sys(const QString &fullVersion) QStringList QLibraryPrivate::suffixes_sys(const QString &fullVersion)
{ {
QStringList suffixes; QStringList suffixes;
@ -250,7 +244,7 @@ bool QLibraryPrivate::load_sys()
locker.relock(); locker.relock();
if (!hnd) { if (!hnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror()); errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, dlerror());
} }
if (hnd) { if (hnd) {
qualifiedFileName = attempt; qualifiedFileName = attempt;
@ -264,15 +258,15 @@ bool QLibraryPrivate::unload_sys()
{ {
#if !defined(Q_OS_VXWORKS) // Unloading on VxWorks causes crashes in QtDeclarative autotests #if !defined(Q_OS_VXWORKS) // Unloading on VxWorks causes crashes in QtDeclarative autotests
if (dlclose(pHnd.loadAcquire())) { if (dlclose(pHnd.loadAcquire())) {
#if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in const char *error = dlerror();
char *error = dlerror(); // QtDeclarative auto test "qqmlenginecleanup" for instance #if defined (Q_OS_QNX)
// Workaround until fixed in QNX; fixes crash in
// QtDeclarative auto test "qqmlenginecleanup" for instance
if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative" if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative"
return true; return true;
#endif
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName, errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName,
QLatin1StringView(error)); QLatin1StringView(error));
#else
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName, qdlerror());
#endif
return false; return false;
} }
errorString.clear(); errorString.clear();