Skip to content

Commit

Permalink
IPC: include the error text instead of errno code in errorString
Browse files Browse the repository at this point in the history
It's much easier to tell what happened.

Change-Id: I12a088d1ae424825abd3fffd171dbeb58c46fd6d
Reviewed-by: Tor Arne Vestbø <[email protected]>
Reviewed-by: Mårten Nordheim <[email protected]>
  • Loading branch information
thiagomacieira committed Jan 22, 2023
1 parent c9440c9 commit a467362
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/corelib/ipc/qsharedmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/corelib/ipc/qsharedmemory_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/corelib/ipc/qsystemsemaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/corelib/ipc/qsystemsemaphore_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a467362

Please sign in to comment.