libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 23f136448c877efd31e7555eec97d436c747f5e3
parent a655a66c70cd50a6e8a858465572d042f03114f4
Author: LRN <lrn1986@gmail.com>
Date:   Sun,  3 Feb 2013 17:56:41 +0000

Fix eof detection in flac plugin

Prevents it from busylooping forever when parent process suddenly dies.

Diffstat:
Msrc/plugins/flac_extractor.c | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/plugins/flac_extractor.c b/src/plugins/flac_extractor.c @@ -150,9 +150,17 @@ flac_eof (const FLAC__StreamDecoder *decoder, void *client_data) { struct EXTRACTOR_ExtractContext *ec = client_data; - - return (ec->get_size (ec->cls) == - ec->seek (ec->cls, 0, SEEK_CUR)) ? true : false; + uint64_t size; + int64_t seekresult; + size = ec->get_size (ec->cls); + seekresult = ec->seek (ec->cls, 0, SEEK_CUR); + + if (seekresult == -1) + /* Treat seek error as error (not as indication of file not being + * seekable). + */ + return true; + return (size == seekresult) ? true : false; }