centos 7
obsolete weakness #270

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:

pam_krb5-2.4.8/tests/tools/meanwhile.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 obsolete weakness.

 	}
	/* Run the foreground command. */
	if (verbose) {
		fprintf(stderr, "[%ld] %s\n", (long) getpid(), cmd);
	}
	ret = system(cmd);
	if (verbose) {
		fprintf(stderr, "[%ld] result is %d\n", (long) getpid(), ret);
	}
	/* Clean up the background processes. */
	for (i = 0; i < n_children; i++) {
		if (children[i] == -1) {
			continue;
		}
		status = 0;
		mul = 1;
		sig = SIGTERM;
		while (waitpid(children[i], &status, WNOHANG) != children[i]) {
			if (verbose) {
				fprintf(stderr, "[%ld] kill -%s %ld\n",
					(long) getpid(), strsignal(sig),
					(long) children[i]);
			}
			kill(children[i], sig);
			usleep(mul++ * 100000);
			if (mul > 20) {
				sig = SIGKILL;
			}
		}
		if (verbose) {
			printf("Process %ld (%s) stopped.\n",
			       (long) children[i], cmds[i]);
		}
	}
	return ret;
} 

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.