From 012b5b8d4a28144d05b3d6ee542ecba2423e2308 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 16 Apr 2014 15:23:57 +0200 Subject: [PATCH] dvbsrc: Handle failure to get statistics from the device Check the ioctl return value and don't output bogus values. CID #206016 --- sys/dvb/gstdvbsrc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c index 148694e822..9e2402366d 100644 --- a/sys/dvb/gstdvbsrc.c +++ b/sys/dvb/gstdvbsrc.c @@ -1453,11 +1453,14 @@ gst_dvbsrc_output_frontend_stats (GstDvbSrc * src) GstStructure *structure; int fe_fd = src->fd_frontend; - ioctl (fe_fd, FE_READ_STATUS, &status); - ioctl (fe_fd, FE_READ_SIGNAL_STRENGTH, &_signal); - ioctl (fe_fd, FE_READ_SNR, &snr); - ioctl (fe_fd, FE_READ_BER, &ber); - ioctl (fe_fd, FE_READ_UNCORRECTED_BLOCKS, &uncorrected_blocks); + if (ioctl (fe_fd, FE_READ_STATUS, &status) || + ioctl (fe_fd, FE_READ_SIGNAL_STRENGTH, &_signal) || + ioctl (fe_fd, FE_READ_SNR, &snr) || + ioctl (fe_fd, FE_READ_BER, &ber) || + ioctl (fe_fd, FE_READ_UNCORRECTED_BLOCKS, &uncorrected_blocks)) { + GST_WARNING_OBJECT (src, "Failed to get statistics from the device"); + return; + } structure = gst_structure_new ("dvb-frontend-stats", "status", G_TYPE_INT, status, "signal", G_TYPE_INT, _signal, "snr", G_TYPE_INT, snr,