mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Call fflush() before ftruncate() to drop all buffered data (#914)
This avoids stale data presented to caller via a fread() Current bug due to the buffered data can be seen in stripping mp3s of tags f.strip(ID3v1); f.strip(APE); The ID3v1 tag sits at the end of file (strip calls ftruncate()) and the APE strip performs a readFile() that would return the stream buffered/truncated data and reinsert
This commit is contained in:
parent
ba7adc2bc2
commit
79bc9ccf8e
@ -493,6 +493,7 @@ void FileStream::truncate(long length)
|
||||
|
||||
#else
|
||||
|
||||
fflush(d->file);
|
||||
const int error = ftruncate(fileno(d->file), length);
|
||||
if(error != 0)
|
||||
debug("FileStream::truncate() -- Coundn't truncate the file.");
|
||||
|
Loading…
Reference in New Issue
Block a user