Revert all changes since a36d4918a6f646e085
[platform/upstream/dbus.git] / bus / dir-watch-kqueue.c
index e7b0e2c..4e436eb 100644 (file)
@@ -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)
             {
@@ -204,11 +204,20 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories)
           * we may need to sleep.
           */
           fd = open (new_dirs[i], O_RDONLY);
-         if (fd < 0)
+          if (fd < 0)
             {
-              _dbus_warn ("Cannot open directory '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
-             goto out;
-           }
+              if (errno != ENOENT)
+                {
+                  _dbus_warn ("Cannot open directory '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+                  goto out;
+                }
+              else
+                {
+                  new_fds[i] = -1;
+                  new_dirs[i] = NULL;
+                  continue;
+                }
+            }
 
           EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
                   NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);