centos 7
obsolete weakness #277

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:

libqb-1.0.1/tests/check_util.c

Context:

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

 
START_TEST(test_check_overwrite)
{
	uint64_t res;
	uint32_t last;
	qb_util_stopwatch_t *sw = qb_util_stopwatch_create();

	qb_util_stopwatch_split_ctl(sw, 5, QB_UTIL_SW_OVERWRITE);

	res = qb_util_stopwatch_split(sw);
	assert_int_between(res, 0, 100);

	usleep(10000);
	res = qb_util_stopwatch_split(sw);
	assert_int_between(res, 9000, 11000);

	usleep(20000);
	res = qb_util_stopwatch_split(sw);
	assert_int_between(res, 19000, 21000);

	usleep(30000);
	res = qb_util_stopwatch_split(sw);
	assert_int_between(res, 29000, 31000);

	usleep(40000);
	res = qb_util_stopwatch_split(sw);
	assert_int_between(res, 39000, 41000);

	/*
	 * window should be 100000 (40000 + 30000 + 20000 + 10000) usec
	 */
	last = qb_util_stopwatch_split_last(sw);
	res = qb_util_stopwatch_time_split_get(sw, last, last - 4);
	assert_int_between(res, 95000, 105000);

	usleep(50000);
	res = qb_util_stopwatch_split(sw);
	assert_int_between(res, 49000, 52000);
	/*
	 * window should be 140000 (50000 + 40000 + 30000 + 20000) usec
	 */
	last = qb_util_stopwatch_split_last(sw);
	res = qb_util_stopwatch_time_split_get(sw, last, last - 4);
	assert_int_between(res, 135000, 145000);

	usleep(25000);
	qb_util_stopwatch_split(sw);

	/* ask for a split that has been overwritten.
	 */ 

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.