centos 7
obsolete weakness #279

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.

 	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.
	 */
	res = qb_util_stopwatch_time_split_get(sw, last, 1);
	ck_assert_int_eq(res, 0);

	/* iterating
	 */
	last = qb_util_stopwatch_split_last(sw);
	do {
		res = qb_util_stopwatch_time_split_get(sw, last, last);
		qb_log(LOG_INFO, "overwrite split %d is %"PRIu64"", last, res);
		last--;
	} while (res > 0);

	qb_util_stopwatch_free(sw);
}
END_TEST

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

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.