alpine 3.9
obsolete weakness #557

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:

alsa-utils/src/alsa-utils-1.1.8/alsaloop/pcmjob.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.9 obsolete weakness.

 {
	int err;

	if (lhandle == lhandle->loopback->play) {
		logit(LOG_DEBUG, "underrun for %s\n", lhandle->id);
		xrun_stats(lhandle->loopback);
		if ((err = snd_pcm_prepare(lhandle->handle)) < 0)
			return err;
		lhandle->xrun_pending = 1;
	} else {
		logit(LOG_DEBUG, "overrun for %s\n", lhandle->id);
		xrun_stats(lhandle->loopback);
		if ((err = snd_pcm_prepare(lhandle->handle)) < 0)
			return err;
		lhandle->xrun_pending = 1;
	}
	return 0;
}

static int suspend(struct loopback_handle *lhandle)
{
	int err;

	while ((err = snd_pcm_resume(lhandle->handle)) == -EAGAIN)
		usleep(1);
	if (err < 0)
		return xrun(lhandle);
	return 0;
}

static int readit(struct loopback_handle *lhandle)
{
	snd_pcm_sframes_t r, res = 0;
	snd_pcm_sframes_t avail;
	int err;

	avail = snd_pcm_avail_update(lhandle->handle);
	if (avail == -EPIPE) {
		return xrun(lhandle);
	} else if (avail == -ESTRPIPE) {
		if ((err = suspend(lhandle)) < 0)
			return err;
	}
	if (avail > buf_avail(lhandle)) {
		lhandle->buf_over += avail - buf_avail(lhandle);
		avail = buf_avail(lhandle);
	} else if (avail == 0) {
		if (snd_pcm_state(lhandle->handle) == SND_PCM_STATE_DRAINING) {
			lhandle->loopback->reinit = 1;
			return 0; 

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.