Check-in [64aa5e7fb5]
Overview
Comment:Fixed issue with initializing timeout structures when using chroot()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:64aa5e7fb52321d9d9fbc5df194e6b4a2d37d8d6
User & Date: rkeene on 2016-02-22 22:34:52
Other Links: manifest | tags
Context
2016-02-22
22:35
Filed 1.16 check-in: 395483fa73 user: rkeene tags: trunk, 1.16
22:34
Fixed issue with initializing timeout structures when using chroot() check-in: 64aa5e7fb5 user: rkeene tags: trunk
22:11
Post-release version increment check-in: 5a4a432e88 user: rkeene tags: trunk
Changes

Modified filed.c from [3cf4489884] to [df8bd5d3b2].

742
743
744
745
746
747
748







749
750
751
752
753
754
755
...
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
....
1753
1754
1755
1756
1757
1758
1759








1760
1761
1762
1763
1764
1765
1766
....
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826

	/* NOTREACH: We don't actually take any arguments */
	arg = arg;
}

static int filed_sockettimeout_thread_init(void) {
	pthread_t thread_id;







	long maxfd, idx;

	maxfd = sysconf(_SC_OPEN_MAX);
	if (maxfd <= 0) {
		maxfd = 4096;
	}

................................................................................
	}

	for (idx = 0; idx < maxfd; idx++) {
		filed_sockettimeout_sockstatus[idx].valid = false;
	}

	filed_sockettimeout_sockstatus_length = maxfd;

	filed_sockettimeout_devnull_fd = open("/dev/null", O_RDWR);
	if (filed_sockettimeout_devnull_fd < 0) {
		return(-1);
	}

	pthread_create(&thread_id, NULL, filed_sockettimeout_thread, NULL);

	return(0);
}
#endif

/* Format time per RFC2616 */
static char *filed_format_time(char *buffer, size_t buffer_len, const time_t timeinfo) {
	struct tm timeinfo_tm, *timeinfo_tm_p;
................................................................................
	/* Create listening socket */
	fd = filed_listen(bind_addr, port);
	if (fd < 0) {
		perror("filed_listen");

		return(1);
	}









	/* Become a daemon */
	if (daemon_enabled) {
		init_ret = filed_daemonize();
		if (init_ret != 0) {
			perror("filed_daemonize");

................................................................................
	}

	/* Create socket termination thread */
	init_ret = filed_sockettimeout_thread_init();
	if (init_ret != 0) {
		perror("filed_sockettimeout_thread_init");

		return(6);
	}

	/* Create worker threads */
	init_ret = filed_worker_threads_init(fd, thread_count, &thread_options);
	if (init_ret != 0) {
		perror("filed_worker_threads_init");








>
>
>
>
>
>
>







 







<





<
<







 







>
>
>
>
>
>
>
>







 







|







742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
...
766
767
768
769
770
771
772

773
774
775
776
777


778
779
780
781
782
783
784
....
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
....
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838

	/* NOTREACH: We don't actually take any arguments */
	arg = arg;
}

static int filed_sockettimeout_thread_init(void) {
	pthread_t thread_id;

	pthread_create(&thread_id, NULL, filed_sockettimeout_thread, NULL);

	return(0);
}

static int filed_sockettimeout_init(void) {
	long maxfd, idx;

	maxfd = sysconf(_SC_OPEN_MAX);
	if (maxfd <= 0) {
		maxfd = 4096;
	}

................................................................................
	}

	for (idx = 0; idx < maxfd; idx++) {
		filed_sockettimeout_sockstatus[idx].valid = false;
	}

	filed_sockettimeout_sockstatus_length = maxfd;

	filed_sockettimeout_devnull_fd = open("/dev/null", O_RDWR);
	if (filed_sockettimeout_devnull_fd < 0) {
		return(-1);
	}



	return(0);
}
#endif

/* Format time per RFC2616 */
static char *filed_format_time(char *buffer, size_t buffer_len, const time_t timeinfo) {
	struct tm timeinfo_tm, *timeinfo_tm_p;
................................................................................
	/* Create listening socket */
	fd = filed_listen(bind_addr, port);
	if (fd < 0) {
		perror("filed_listen");

		return(1);
	}

	/* Initialize timeout structures */
	init_ret = filed_sockettimeout_init();
	if (init_ret != 0) {
		perror("filed_sockettimeout_init");

		return(8);
	}

	/* Become a daemon */
	if (daemon_enabled) {
		init_ret = filed_daemonize();
		if (init_ret != 0) {
			perror("filed_daemonize");

................................................................................
	}

	/* Create socket termination thread */
	init_ret = filed_sockettimeout_thread_init();
	if (init_ret != 0) {
		perror("filed_sockettimeout_thread_init");

		return(7);
	}

	/* Create worker threads */
	init_ret = filed_worker_threads_init(fd, thread_count, &thread_options);
	if (init_ret != 0) {
		perror("filed_worker_threads_init");