diff options
Diffstat (limited to 'src/corelib/kernel/qcore_unix_p.h')
-rw-r--r-- | src/corelib/kernel/qcore_unix_p.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index c744873fce..f80dcb5a50 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -47,6 +47,7 @@ #include "qplatformdefs.h" #include "qatomic.h" +#include "qhash.h" #ifndef Q_OS_UNIX # error "qcore_unix_p.h included on a non-Unix system" @@ -322,6 +323,19 @@ union qt_semun { unsigned short *array; /* array for GETALL, SETALL */ }; +#ifndef QT_POSIX_IPC +#ifndef QT_NO_SHAREDMEMORY +#ifndef Q_OS_ANDROID +static inline key_t qt_safe_ftok(const QByteArray &filename, int proj_id) +{ + // Unfortunately ftok can return colliding keys even for different files. + // Try to add some more entropy via qHash. + return ::ftok(filename.constData(), qHash(filename, proj_id)); +} +#endif // !Q_OS_ANDROID +#endif // !QT_NO_SHAREDMEMORY +#endif // !QT_POSIX_IPC + QT_END_NAMESPACE #endif |