alpine 3.6
obsolete weakness #289

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.

 					}
					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 {
						usleep(1000);
					}
				}
				else if (pids[i].revents) {
					ttg = true;
					syslog(LOG_ERR, "Error with main listening socket.  Exiting.");
					break;
				}
			}
			if (ttg)
				break;
		}

		if (freechildren < o.minspare_children && (waitingfor == 0) && numchildren < o.max_children) {
			if (o.logchildprocs)
				syslog(LOG_ERR, "Fewer than %d free children - Spawning %d process(es)", o.minspare_children, o.prefork_children);
			rc = prefork(o.prefork_children);
			if (rc < 0) {
				syslog(LOG_ERR, "Error forking preforkchildren extra processes.");
				failurecount++;
			}
		}

		if (freechildren <= o.maxspare_children) {
			time(&tmaxspare);
		} 

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.