Skip to content

Commit

Permalink
FIX: dinit-iostream.h: Implement template write(...) in terms of that…
Browse files Browse the repository at this point in the history
… function write_nx(...)

Signed-off-by: Mobin Aydinfar <[email protected]>
  • Loading branch information
mobin-2008 committed Dec 18, 2024
1 parent 99adafe commit ba9a071
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/includes/dinit-iostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,12 @@ class ostream : public io_base

template <typename A, typename B, typename ...C> inline bool write(const A &a, const B &b, const C & ...c)
{
if (!good()) return false;
if (!write(a)) return false;
if (!write(b, c...)) return false;
return true;
bool r = write_nx(a, b, c...);
if (!r) {
// This will definitely throw an exception
throw_exception_on(io_states::buffer_failbit | io_states::io_failbit);
}
return r;
}

// write_buf() functions, Used to write char* or std::string.
Expand Down

0 comments on commit ba9a071

Please sign in to comment.