1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

* Clean up exception handling.

This commit is contained in:
Eelco Dolstra 2011-12-16 15:45:42 +00:00
parent 5a1b9ed0aa
commit 78598d06f0
2 changed files with 10 additions and 3 deletions

View file

@ -41,8 +41,15 @@ void BufferedSink::operator () (const unsigned char * data, size_t len)
void BufferedSink::flush()
{
if (bufPos == 0) return;
write(buffer, bufPos);
bufPos = 0;
size_t n = bufPos;
bufPos = 0; // don't trigger the assert() in ~BufferedSink()
write(buffer, n);
}
FdSink::~FdSink()
{
try { flush(); } catch (...) { ignoreException(); }
}