centos 7
obsolete weakness #272

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/lib/loop_poll_epoll.c

Context:

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

 	int32_t res;
	int32_t event_count;
	int32_t new_jobs = 0;
	struct qb_poll_entry *pe = NULL;
	struct qb_poll_source *s = (struct qb_poll_source *)src;
	struct epoll_event events[MAX_EVENTS];

	qb_poll_fds_usage_check_(s);

retry_poll:

	event_count = epoll_wait(s->epollfd, events, MAX_EVENTS, ms_timeout);

	if (errno == EINTR && event_count == -1) {
		goto retry_poll;
	} else if (event_count == -1) {
		return -errno;
	}

	for (i = 0; i < event_count; i++) {
		res = _poll_entry_from_handle_(s, events[i].data.u64, &pe);
		if (res != 0) {
			qb_util_log(LOG_WARNING,
				    "can't find poll entry for new event.");
			usleep(100000);
			continue;
		}
		if (pe->ufd.fd == -1 || pe->state == QB_POLL_ENTRY_DELETED) {
			qb_util_log(LOG_WARNING,
				    "can't post new event to a deleted entry.");
			/*
			 * empty/deleted
			 */
			continue;
		}

		pe->ufd.revents |= _epoll_to_poll_event_(events[i].events);

		if (pe->state != QB_POLL_ENTRY_JOBLIST) {
			new_jobs += pe->add_to_jobs(src->l, pe);
		}
	}

	return new_jobs;
}

int32_t
qb_epoll_init(struct qb_poll_source *s)
{
	s->epollfd = epoll_create1(EPOLL_CLOEXEC); 

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.