summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-12-01 09:54:23 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-12-01 09:54:23 (GMT)
commit6c8d6127d29266310ee797a19f3388ca7daadd92 (patch)
treefe36289ccab8a5ed3b4ab32ff1eb01ce82484b8e /src/corelib/io
parent700a069591d29733609e619c224861ca774bfb32 (diff)
downloadQt-6c8d6127d29266310ee797a19f3388ca7daadd92.zip
Qt-6c8d6127d29266310ee797a19f3388ca7daadd92.tar.gz
Qt-6c8d6127d29266310ee797a19f3388ca7daadd92.tar.bz2
Make sure file descriptors are valid in the dnotify implementation of QFileSystemWatcher
Commit 71c3227ba260b964b0c9516f05ad4f2e6fa72f69 fixed a memory leak by calling closedir(), which would also close the file descriptor we were wanting to watch. Fix this by duplicating the file descriptor that we store. Reviewed-by: TrustMe
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfilesystemwatcher_dnotify.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
index 03172e5..1fab010 100644
--- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp
@@ -269,8 +269,8 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths,
}
}
- fd = ::dirfd(d);
- int parentFd = parent?::dirfd(parent):0;
+ fd = qt_safe_dup(::dirfd(d));
+ int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0;
Q_ASSERT(fd);
if(::fcntl(fd, F_SETSIG, SIGIO) ||