ref: c1f0c1da94485f4669f6b4e7404a6dee10bcc568
parent: bc6c1a7c0aa7b43f53578a78d8794d9b94693993
author: Paul Brossier <[email protected]>
date: Mon Feb 3 11:21:11 EST 2014
src/io/source_wavread.c: avoid calling fclose twice, print an error if fclose fails
--- a/src/io/source_wavread.c
+++ b/src/io/source_wavread.c
@@ -347,9 +347,14 @@
}
uint_t aubio_source_wavread_close (aubio_source_wavread_t * s) {
- if (!s->fid || fclose(s->fid)) {
+ if (!s->fid) {
return AUBIO_FAIL;
}
+ if (fclose(s->fid)) {
+ AUBIO_ERR("source_wavread: could not close %s (%s)\n", s->path, strerror(errno));
+ return AUBIO_FAIL;
+ }
+ s->fid = NULL;
return AUBIO_OK;
}