From 72b0788bc3e9b9b2a20ce5031a4b7de846304304 Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Fri, 29 Jul 2005 17:43:23 +0000 Subject: - Patches to fix crash involving deleted files. Not bumping PORTREVISION because the crash is rare (unless you delete files as you listen to them) Approved by: maintainer Obtained from: author --- audio/moc/files/patch-decoder__plugins_mp3_mp3.c | 19 ++++++++ audio/moc/files/patch-io_open.c | 57 ++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 audio/moc/files/patch-decoder__plugins_mp3_mp3.c create mode 100644 audio/moc/files/patch-io_open.c (limited to 'audio/moc') diff --git a/audio/moc/files/patch-decoder__plugins_mp3_mp3.c b/audio/moc/files/patch-decoder__plugins_mp3_mp3.c new file mode 100644 index 000000000000..e4c715608bcc --- /dev/null +++ b/audio/moc/files/patch-decoder__plugins_mp3_mp3.c @@ -0,0 +1,19 @@ +--- decoder_plugins/mp3/mp3.c.orig Wed Jun 15 18:56:45 2005 ++++ decoder_plugins/mp3/mp3.c Fri Jul 29 14:28:05 2005 +@@ -353,10 +353,13 @@ + + debug ("Processing file %s", file); + +- if (!(data = mp3_open_internal(file, 0))) +- time = -1; +- else ++ data = mp3_open_internal (file, 0); ++ ++ if (data->ok) + time = data->duration; ++ else ++ time = -1; ++ + mp3_close (data); + + return time; diff --git a/audio/moc/files/patch-io_open.c b/audio/moc/files/patch-io_open.c new file mode 100644 index 000000000000..6ebf67000af3 --- /dev/null +++ b/audio/moc/files/patch-io_open.c @@ -0,0 +1,57 @@ +Index: io.c +=================================================================== +--- io.c (revision 1506) ++++ io.c (revision 1507) +@@ -300,16 +300,6 @@ + if (s->source == IO_SOURCE_FD) + close (s->fd); + +- if (pthread_mutex_destroy(&s->buf_mutex)) +- logit ("Destroying buf_mutex failed: %s", +- strerror(errno)); +- if (pthread_mutex_destroy(&s->io_mutex)) +- logit ("Destroying io_mutex failed: %s", +- strerror(errno)); +- if (pthread_mutex_destroy(&s->metadata.mutex)) +- logit ("Destroying metadata mutex failed: %s", +- strerror(errno)); +- + if (s->buffered) { + fifo_buf_destroy (&s->buf); + if (pthread_cond_destroy(&s->buf_free_cond)) +@@ -326,6 +316,13 @@ + free (s->metadata.url); + } + ++ if (pthread_mutex_destroy(&s->buf_mutex)) ++ logit ("Destroying buf_mutex failed: %s", strerror(errno)); ++ if (pthread_mutex_destroy(&s->io_mutex)) ++ logit ("Destroying io_mutex failed: %s", strerror(errno)); ++ if (pthread_mutex_destroy(&s->metadata.mutex)) ++ logit ("Destroying metadata mutex failed: %s", strerror(errno)); ++ + if (s->strerror) + free (s->strerror); + free (s); +@@ -493,6 +490,10 @@ + #endif + io_open_file (s, file); + ++ pthread_mutex_init (&s->buf_mutex, NULL); ++ pthread_mutex_init (&s->io_mutex, NULL); ++ pthread_mutex_init (&s->metadata.mutex, NULL); ++ + if (!s->opened) + return s; + +@@ -503,10 +504,6 @@ + s->pos = 0; + memset (&s->metadata, 0, sizeof(s->metadata)); + +- pthread_mutex_init (&s->buf_mutex, NULL); +- pthread_mutex_init (&s->io_mutex, NULL); +- pthread_mutex_init (&s->metadata.mutex, NULL); +- + if (buffered) { + fifo_buf_init (&s->buf, options_get_int("InputBuffer") * 1024); + s->prebuffer = options_get_int("Prebuffering") * 1024; -- cgit v1.2.3