IPC: include the error text instead of errno code in errorString

It's much easier to tell what happened.

Change-Id: I12a088d1ae424825abd3fffd171dbeb58c46fd6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Thiago Macieira 2022-10-13 14:38:44 -07:00
parent c9440c9ca0
commit a467362aa8
4 changed files with 8 additions and 4 deletions

View File

@ -670,7 +670,8 @@ void QSharedMemoryPrivate::setUnixErrorString(QLatin1StringView function)
error = QSharedMemory::OutOfResources;
break;
default:
errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(errno);
errorString = QSharedMemory::tr("%1: unknown error: %2")
.arg(function, qt_error_string(errno));
error = QSharedMemory::UnknownError;
#if defined QSHAREDMEMORY_DEBUG
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;

View File

@ -41,7 +41,8 @@ void QSharedMemoryPrivate::setWindowsErrorString(QLatin1StringView function)
errorString = QSharedMemory::tr("%1: permission denied").arg(function);
break;
default:
errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(windowsError);
errorString = QSharedMemory::tr("%1: unknown error: %2")
.arg(function, qt_error_string(windowsError));
error = QSharedMemory::UnknownError;
#if defined QSHAREDMEMORY_DEBUG
qDebug() << errorString << "key" << key;

View File

@ -351,7 +351,8 @@ void QSystemSemaphorePrivate::setUnixErrorString(QLatin1StringView function)
error = QSystemSemaphore::KeyError;
break;
default:
errorString = QSystemSemaphore::tr("%1: unknown error %2").arg(function).arg(errno);
errorString = QSystemSemaphore::tr("%1: unknown error: %2")
.arg(function, qt_error_string(errno));
error = QSystemSemaphore::UnknownError;
#if defined QSYSTEMSEMAPHORE_DEBUG
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;

View File

@ -30,7 +30,8 @@ void QSystemSemaphorePrivate::setWindowsErrorString(QLatin1StringView function)
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: permission denied").arg(function);
break;
default:
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: unknown error %2").arg(function).arg(windowsError);
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: unknown error: %2")
.arg(function, qt_error_string(windowsError));
error = QSystemSemaphore::UnknownError;
#if defined QSYSTEMSEMAPHORE_DEBUG
qDebug() << errorString << "key" << key;