- 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
This commit is contained in:
Pav Lucistnik 2005-07-29 17:43:23 +00:00
parent 96eadb8b04
commit 72b0788bc3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=140417
2 changed files with 76 additions and 0 deletions

View file

@ -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;

View file

@ -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;