Explicitly cast major() and minor() to uints

On FreeBSD, the major() and the minor() macros return ints instead of
uints.
This commit is contained in:
Vlad Zahorodnii 2021-04-27 12:02:38 +03:00
parent ba0e18955b
commit d7e9c717af
2 changed files with 8 additions and 4 deletions

View file

@ -171,7 +171,8 @@ int ConsoleKitSession::openRestricted(const QString &fileName)
QDBusMessage message = QDBusMessage::createMethodCall(s_serviceName, m_sessionPath,
s_sessionInterface,
QStringLiteral("TakeDevice"));
message.setArguments({ major(st.st_rdev), minor(st.st_rdev) });
// major() and minor() macros return ints on FreeBSD instead of uints.
message.setArguments({uint(major(st.st_rdev)), uint(minor(st.st_rdev))});
const QDBusMessage reply = QDBusConnection::systemBus().call(message);
if (reply.type() == QDBusMessage::ErrorMessage) {
@ -199,7 +200,8 @@ void ConsoleKitSession::closeRestricted(int fileDescriptor)
QDBusMessage message = QDBusMessage::createMethodCall(s_serviceName, m_sessionPath,
s_sessionInterface,
QStringLiteral("ReleaseDevice"));
message.setArguments({ major(st.st_rdev), minor(st.st_rdev) });
// major() and minor() macros return ints on FreeBSD instead of uints.
message.setArguments({uint(major(st.st_rdev)), uint(minor(st.st_rdev))});
QDBusConnection::systemBus().asyncCall(message);

View file

@ -177,7 +177,8 @@ int LogindSession::openRestricted(const QString &fileName)
QDBusMessage message = QDBusMessage::createMethodCall(s_serviceName, m_sessionPath,
s_sessionInterface,
QStringLiteral("TakeDevice"));
message.setArguments({ major(st.st_rdev), minor(st.st_rdev) });
// major() and minor() macros return ints on FreeBSD instead of uints.
message.setArguments({uint(major(st.st_rdev)), uint(minor(st.st_rdev))});
const QDBusMessage reply = QDBusConnection::systemBus().call(message);
if (reply.type() == QDBusMessage::ErrorMessage) {
@ -205,7 +206,8 @@ void LogindSession::closeRestricted(int fileDescriptor)
QDBusMessage message = QDBusMessage::createMethodCall(s_serviceName, m_sessionPath,
s_sessionInterface,
QStringLiteral("ReleaseDevice"));
message.setArguments({ major(st.st_rdev), minor(st.st_rdev) });
// major() and minor() macros return ints on FreeBSD instead of uints.
message.setArguments({uint(major(st.st_rdev)), uint(minor(st.st_rdev))});
QDBusConnection::systemBus().asyncCall(message);