alpine 3.6
obsolete weakness #89

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:

v4l-utils/src/v4l-utils-1.12.5/utils/rds-ctl/rds-ctl.cpp

Context:

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

 	if (params.options[OptTMC])
		print_rds_tmc(handle, updated_fields);
}

static void read_rds(struct v4l2_rds *handle, const int fd, const int wait_limit)
{
	int byte_cnt = 0;
	int error_cnt = 0;
	uint32_t updated_fields = 0x00;
	struct v4l2_rds_data rds_data; /* read buffer for rds blocks */

	while (!params.terminate_decoding) {
		memset(&rds_data, 0, sizeof(rds_data));
		if ((byte_cnt=read(fd, &rds_data, 3)) != 3) {
			if (byte_cnt == 0) {
				printf("\nEnd of input file reached \n");
				break;
			} else if(++error_cnt > 2) {
				fprintf(stderr, "\nError reading from "
					"device (no RDS data available)\n");
				break;
			}
			/* wait for new data to arrive: transmission of 1
			 * group takes ~88.7ms */
			usleep(wait_limit * 1000);
		}
		else if (byte_cnt == 3) {
			error_cnt = 0;
			/* true if a new group was decoded */
			if ((updated_fields = v4l2_rds_add(handle, &rds_data))) {
				print_rds_data(handle, updated_fields);
				if (params.options[OptVerbose])
					 print_rds_group(v4l2_rds_get_group(handle));
			}
		}
	}
	/* print a summary of all valid RDS-fields before exiting */
	printf("\nSummary of valid RDS-fields:");
	print_rds_data(handle, 0xFFFFFFFF);
}

static void read_rds_from_fd(const int fd)
{
	struct v4l2_rds *rds_handle;

	/* create an rds handle for the current device */
	if (!(rds_handle = v4l2_rds_create(params.options[OptRBDS]))) {
		fprintf(stderr, "Failed to init RDS lib: %s\n", strerror(errno));
		exit(1);
	} 

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.