- if (start > 0) {
- /* if asked for, wait for a specific sequence of events */
- if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) {
- rc = EXIT_SUCCESS;
- break;
- }
- } else {
- /* exit if queue is empty */
- if (udev_queue_get_queue_is_empty(udev_queue)) {
- rc = EXIT_SUCCESS;
- break;
- }
- }
-
- if (pfd[0].fd >= 0) {
- int delay;
-
- if (exists != NULL || start > 0)
- delay = 100;
- else
- delay = 1000;
- /* wake up after delay, or immediately after the queue is rebuilt */
- if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) {
- char buf[sizeof(struct inotify_event) + PATH_MAX];
-
- read(pfd[0].fd, buf, sizeof(buf));
- }
- } else {
- sleep(1);