summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2014-04-16 15:23:57 +0200
committerEdward Hervey <edward@collabora.com>2014-04-16 15:23:57 +0200
commit012b5b8d4a28144d05b3d6ee542ecba2423e2308 (patch)
treeef5d5f3557854a84b88fe90b028eb39c1c2442a7
parentc947e820cf12042ae488d92dc35eac80fac6863b (diff)
dvbsrc: Handle failure to get statistics from the device
Check the ioctl return value and don't output bogus values. CID #206016
-rw-r--r--sys/dvb/gstdvbsrc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c
index 148694e82..9e2402366 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,