Ticket #43203: patch-bus-dir-watch-kqueue.c.diff

File patch-bus-dir-watch-kqueue.c.diff, 789 bytes (added by RJVB (René Bertin), 11 years ago)

modified bus/dir-watch-kqueue patch that is transparant on systems having O_CLOEXEC

  • bus/dir-watch-kqueue.c

    old new  
    259259          /* FIXME - less lame error handling for failing to add a watch;
    260260           * we may need to sleep.
    261261           */
     262#ifdef O_CLOEXEC
    262263          fd = open (new_dirs[i], O_RDONLY | O_CLOEXEC);
     264#else
     265          fd = open (new_dirs[i], O_RDONLY);
     266#endif
    263267          if (fd < 0)
    264268            {
    265269              if (errno != ENOENT)
     
    274278                  continue;
    275279                }
    276280            }
     281#ifndef O_CLOEXEC
     282                _dbus_fd_set_close_on_exec(fd);
     283#endif
    277284
    278285          EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
    279286                  NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);