Simplify checking of the SHM/SEM Unix key file's existence
We don't need to stat(2) the file to check if it exists before creating it. We're about to open(2) with O_CREAT|O_EXCL, which will not recreate it if it existed. Change-Id: I2d2176054e7776a32a4520832ee104b9c4ccf748 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Richard J. Moore <rich@kde.org>bb10
parent
3c9cc32086
commit
119c581dd1
|
|
@ -151,9 +151,6 @@ key_t QSharedMemoryPrivate::handle()
|
|||
*/
|
||||
int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName)
|
||||
{
|
||||
if (QFile::exists(fileName))
|
||||
return 0;
|
||||
|
||||
int fd = qt_safe_open(QFile::encodeName(fileName).constData(),
|
||||
O_EXCL | O_CREAT | O_RDWR, 0640);
|
||||
if (-1 == fd) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue