summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-12-01 12:11:51 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-12-01 12:11:51 (GMT)
commitb405b59dca7c3340ce424313c8e538dacbc2e824 (patch)
tree4fca5df1d77fc5efb6f15f5c0151630446c174f5 /src
parent37d7bbf8b055c46de9b45333ab08934e71f60633 (diff)
downloadQt-b405b59dca7c3340ce424313c8e538dacbc2e824.zip
Qt-b405b59dca7c3340ce424313c8e538dacbc2e824.tar.gz
Qt-b405b59dca7c3340ce424313c8e538dacbc2e824.tar.bz2
Fix regression in tst_QFileSystemWatcher
Dnotify doesn't work on dup'ed file descriptors apparently, so we need to closedir() before using fcntl() to set the watches. Reviewed-by: TrustMe
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qfilesystemwatcher_dnotify.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
index 1fab010..c70232c 100644
--- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
@@ -272,6 +272,9 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
fd = qt_safe_dup(::dirfd(d));
int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0;
+ ::closedir(d);
+ if(parent) ::closedir(parent);
+
Q_ASSERT(fd);
if(::fcntl(fd, F_SETSIG, SIGIO) ||
::fcntl(fd, F_NOTIFY, DN_MODIFY | DN_CREATE | DN_DELETE |
@@ -279,10 +282,6 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
(parent && ::fcntl(parentFd, F_SETSIG, SIGIO)) ||
(parent && ::fcntl(parentFd, F_NOTIFY, DN_DELETE | DN_RENAME |
DN_MULTISHOT))) {
-
- ::closedir(d);
- if(parent) ::closedir(parent);
-
continue; // Could not set appropriate flags
}
@@ -295,9 +294,6 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
pathToFD.insert(path, fd);
if(parentFd)
parentToFD.insert(parentFd, fd);
-
- ::closedir(d);
- if(parent) ::closedir(parent);
}
Directory &directory = fdToDirectory[fd];