Project

General

Profile

dhcpleases.patch

Karl Kec, 08/12/2015 11:39 AM

View differences:

dhcpleases.c.new 2015-08-12 07:08:03.023200033 -0700
564 564
	struct sigaction sa;
565 565
	time_t	now;
566 566
	int kq, nev, leasefd = 0, pidf, ch;
567
    struct timespec ktimeout = {300,0};
567 568

  
568 569
	while ((ch = getopt(argc, argv, "c:d:fp:h:l:u:")) != -1) {
569 570
		switch (ch) {
......
711 712
			NOTE_WRITE | NOTE_ATTRIB | NOTE_DELETE | NOTE_RENAME | NOTE_LINK, 0, NULL);
712 713
		/* Loop forever */
713 714
		for (;;) {
714
			nev = kevent(kq, &chlist, 1, &evlist, 1, NULL);
715
			nev = kevent(kq, &chlist, 1, &evlist, 1, &ktimeout);
715 716
			if (nev == -1) {
716 717
				syslog(LOG_ERR, "kqueue error: unkown");
717 718
				close(leasefd);
......
740 741

  
741 742
					signal_process();
742 743
				}
744
			} else if (nev == 0) {
745
                syslog(LOG_INFO, "Timeout with no file change. Re-opening the leases file");
746
                close(leasefd);
747
                goto reopen;
743 748
			}
744 749
		}
745 750
	}