mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
optimize QInotifyFileSystemWatcherEngine::create() for case when IN_CLOEXEC is defined
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
a30a008b15
commit
b66b126357
1 changed files with 8 additions and 7 deletions
|
@ -54,16 +54,17 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create()
|
||||
{
|
||||
int fd = -1;
|
||||
#ifdef IN_CLOEXEC
|
||||
fd = inotify_init1(IN_CLOEXEC);
|
||||
int fd = inotify_init1(IN_CLOEXEC);
|
||||
#else
|
||||
int fd = inotify_init();
|
||||
#endif
|
||||
if (fd == -1) {
|
||||
fd = inotify_init();
|
||||
if (fd == -1)
|
||||
return 0;
|
||||
::fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
if (Q_UNLIKELY(fd == -1)) {
|
||||
return Q_NULLPTR;
|
||||
}
|
||||
#ifndef IN_CLOEXEC
|
||||
::fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
return new QInotifyFileSystemWatcherEngine(fd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue