summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-05-20 16:08:33 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2010-05-21 11:21:20 +0100
commit82a77d6acb0b484a0f21180ad6b8a9b879a54197 (patch)
tree7e663598dc11b8ac53d0e439250c3f891966b785
parent05283235632bc8891aaa3047563cb4a1edada033 (diff)
downloaddbus-82a77d6acb0b484a0f21180ad6b8a9b879a54197.tar.gz
kqueue set_watched_dirs: fix termination condition
num_fds is the number of elements of dirs currently in use. This bug meant that encountering a previously un-watched directory would cause j to increment forever, and so dirs[j] would eventually segfault. (I've checked the corresponding code for inotify, and it's correct. I wonder if some of the duplication could be eliminated.) Thanks to Pablo Martí Gamboa <pmarti@warp.es> for reporting this issue!
-rw-r--r--bus/dir-watch-kqueue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bus/dir-watch-kqueue.c b/bus/dir-watch-kqueue.c
index 4a01b748..4e436eb1 100644
--- a/bus/dir-watch-kqueue.c
+++ b/bus/dir-watch-kqueue.c
@@ -169,7 +169,7 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories)
*/
for (i = 0; new_dirs[i]; i++)
{
- for (j = 0; i < num_fds; j++)
+ for (j = 0; j < num_fds; j++)
{
if (dirs[j] && strcmp (new_dirs[i], dirs[j]) == 0)
{