Commit b517ac74 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Linux DVB: do not run ioctl() on fd == -1

This should fail safe, but it is still ugly.
parent 043553e7
......@@ -632,7 +632,8 @@ float dvb_get_signal_strength (dvb_device_t *d)
{
uint16_t strength;
if (ioctl (d->frontend, FE_READ_SIGNAL_STRENGTH, &strength) < 0)
if (d->frontend == -1
|| ioctl (d->frontend, FE_READ_SIGNAL_STRENGTH, &strength) < 0)
return 0.;
return strength / 65535.;
}
......@@ -641,7 +642,7 @@ float dvb_get_snr (dvb_device_t *d)
{
uint16_t snr;
if (ioctl (d->frontend, FE_READ_SNR, &snr) < 0)
if (d->frontend == -1 || ioctl (d->frontend, FE_READ_SNR, &snr) < 0)
return 0.;
return snr / 65535.;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment