I noticed on my Debian Lenny/Sid system that libflac8 1.2.1-1.2
package's libFLAC.so.8 raises SIGILL in FLAC__cpu_info()
so this patch setups to ignore SIGILL when we do flac(_ogg)_init and
restore the old signal handler after the init
---
src/decoder/flac_plugin.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index a4ccd6e..c515b6c 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -21,6 +21,7 @@
#include "../log.h"
#include <assert.h>
+#include <signal.h>
/* this code was based on flac123, from flac-tools */
@@ -308,6 +309,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
flac_decoder *flacDec;
FlacData data;
const char *err = NULL;
+ __sighandler_t oldill;
if (!(flacDec = flac_new()))
return false;
@@ -321,6 +323,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
#endif
+ oldill = signal(SIGILL, SIG_IGN); // some libflac's cpu_info() makes a SIGILL, so ignore it
if (is_ogg) {
if (!flac_ogg_init(flacDec, flacRead, flacSeek, flacTell,
flacLength, flacEOF, flacWrite, flacMetadata,
@@ -340,6 +343,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
goto fail;
}
}
+ signal(SIGILL, oldill); // let restore the old SIGILL hander
decoder_initialized(decoder, &data.audio_format, data.total_time);
@@ -365,6 +369,8 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
}
fail:
+ signal(SIGILL, oldill);
+
if (data.replayGainInfo)
freeReplayGainInfo(data.replayGainInfo);
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team