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    742   
   743    743   	/* NOTREACH: We don't actually take any arguments */
   744    744   	arg = arg;
   745    745   }
   746    746   
   747    747   static int filed_sockettimeout_thread_init(void) {
   748    748   	pthread_t thread_id;
          749  +
          750  +	pthread_create(&thread_id, NULL, filed_sockettimeout_thread, NULL);
          751  +
          752  +	return(0);
          753  +}
          754  +
          755  +static int filed_sockettimeout_init(void) {
   749    756   	long maxfd, idx;
   750    757   
   751    758   	maxfd = sysconf(_SC_OPEN_MAX);
   752    759   	if (maxfd <= 0) {
   753    760   		maxfd = 4096;
   754    761   	}
   755    762   
................................................................................
   759    766   	}
   760    767   
   761    768   	for (idx = 0; idx < maxfd; idx++) {
   762    769   		filed_sockettimeout_sockstatus[idx].valid = false;
   763    770   	}
   764    771   
   765    772   	filed_sockettimeout_sockstatus_length = maxfd;
   766         -
   767    773   	filed_sockettimeout_devnull_fd = open("/dev/null", O_RDWR);
   768    774   	if (filed_sockettimeout_devnull_fd < 0) {
   769    775   		return(-1);
   770    776   	}
   771    777   
   772         -	pthread_create(&thread_id, NULL, filed_sockettimeout_thread, NULL);
   773         -
   774    778   	return(0);
   775    779   }
   776    780   #endif
   777    781   
   778    782   /* Format time per RFC2616 */
   779    783   static char *filed_format_time(char *buffer, size_t buffer_len, const time_t timeinfo) {
   780    784   	struct tm timeinfo_tm, *timeinfo_tm_p;
................................................................................
  1753   1757   	/* Create listening socket */
  1754   1758   	fd = filed_listen(bind_addr, port);
  1755   1759   	if (fd < 0) {
  1756   1760   		perror("filed_listen");
  1757   1761   
  1758   1762   		return(1);
  1759   1763   	}
         1764  +
         1765  +	/* Initialize timeout structures */
         1766  +	init_ret = filed_sockettimeout_init();
         1767  +	if (init_ret != 0) {
         1768  +		perror("filed_sockettimeout_init");
         1769  +
         1770  +		return(8);
         1771  +	}
  1760   1772   
  1761   1773   	/* Become a daemon */
  1762   1774   	if (daemon_enabled) {
  1763   1775   		init_ret = filed_daemonize();
  1764   1776   		if (init_ret != 0) {
  1765   1777   			perror("filed_daemonize");
  1766   1778   
................................................................................
  1812   1824   	}
  1813   1825   
  1814   1826   	/* Create socket termination thread */
  1815   1827   	init_ret = filed_sockettimeout_thread_init();
  1816   1828   	if (init_ret != 0) {
  1817   1829   		perror("filed_sockettimeout_thread_init");
  1818   1830   
  1819         -		return(6);
         1831  +		return(7);
  1820   1832   	}
  1821   1833   
  1822   1834   	/* Create worker threads */
  1823   1835   	init_ret = filed_worker_threads_init(fd, thread_count, &thread_options);
  1824   1836   	if (init_ret != 0) {
  1825   1837   		perror("filed_worker_threads_init");
  1826   1838