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:
parent
5a1b9ed0aa
commit
78598d06f0
2 changed files with 10 additions and 3 deletions
|
@ -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(); }
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue