alpine 3.6
obsolete weakness #290

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

dansguardian/src/dansguardian-2.12.0.3/src/FatController.cpp

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 obsolete weakness.

 		std::cout << "numchildren:" << numchildren << std::endl;
		std::cout << "busychildren:" << busychildren << std::endl;
		std::cout << "freechildren:" << freechildren << std::endl;
		std::cout << "waitingfor:" << waitingfor << std::endl << std::endl;
#endif

		if (rc > 0) {
			for (i = o.max_children; i < fds; i++) {
				if ((pids[i].revents & POLLIN) > 0) {
					// socket ready to accept() a connection
					failurecount = 0;  // something is clearly working so reset count
					if (freechildren < 1 && numchildren < o.max_children) {
						if (waitingfor == 0) {
							int num = o.prefork_children;
							if ((o.max_children - numchildren) < num)
								num = o.max_children - numchildren;
							if (o.logchildprocs)
								syslog(LOG_ERR, "Under load - Spawning %d process(es)", num);
							rc = prefork(num);
							if (rc < 0) {
								syslog(LOG_ERR, "Error forking %d extra process(es).", num);
								failurecount++;
							}
						} else
							usleep(1000);
						continue;
					}
					if (freechildren > 0) {
#ifdef DGDEBUG
						std::cout<<"telling child to accept "<<(i-o.max_children)<<std::endl;
#endif
						int childnum = getfreechild();
						if (childnum < 0)
						{
							// Oops! weren't actually any free children.
							// Not sure why as yet, but it seems this can
							// sometimes happen. :(  PRA 2009-03-11
							syslog(LOG_WARNING,
								"No free children from getfreechild(): numchildren = %d, busychildren = %d, waitingfor = %d",
								numchildren, busychildren, waitingfor
							);
							freechildren = 0;
							usleep(1000);
						}
						else
						{
							tellchild_accept(childnum, i - o.max_children);
							--freechildren;
						}
					} else { 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.