From 1df8540567d425a6b1b8a6c2f671a0b239bbb793 Mon Sep 17 00:00:00 2001 From: CRC-Mismatch Date: Sun, 21 Sep 2014 22:24:03 -0300 Subject: [PATCH] Update pi_fm_rds.c In case fm_mpx_open() returns -1 (as when it is unable to read from stdin), tx also returns -1 without terminating, causing the Pi to crash & burn with unforeseeable consequences. --- src/pi_fm_rds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pi_fm_rds.c b/src/pi_fm_rds.c index f06b13c..fede423 100644 --- a/src/pi_fm_rds.c +++ b/src/pi_fm_rds.c @@ -419,7 +419,10 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt, int data_index = 0; // Initialize the baseband generator - if(fm_mpx_open(audio_file, DATA_SIZE) < 0) return -1; + if (fm_mpx_open(audio_file, DATA_SIZE) < 0) { + terminate(0); + return -1; + } // Initialize the RDS modulator char myps[9] = {0};