File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
source/intercept/source/collect/db Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -89,16 +89,23 @@ namespace ic::collect::db {
8989 return rust::Ok (std::move (json));
9090 }
9191
92- rust::Result<int > EventsDatabaseWriter::write_to_file (const std::string &content) noexcept {
93- if (-1 == write (file_, content.c_str (), content.size ())) {
94- auto message = fmt::format (
95- " Events db write failed (to file {}): {}" ,
96- path_.string (),
97- sys::error_string (errno)
98- );
99- errno = 0 ;
100- return rust::Result<int >(rust::Err (std::runtime_error (message)));
92+ rust::Result<int > EventsDatabaseWriter::write_to_file (const std::string& content) noexcept {
93+ const char * content_ptr = content.c_str ();
94+ size_t content_length = content.size ();
95+ while (content_length) {
96+ const int written_length = write (file_, content_ptr, content_length);
97+ if (written_length == -1 ) {
98+ auto message = fmt::format (
99+ " Events db write failed (to file {}): {}" ,
100+ path_.string (),
101+ sys::error_string (errno)
102+ );
103+ errno = 0 ;
104+ return rust::Err (std::runtime_error (message));
105+ }
106+ content_length -= written_length;
107+ content_ptr += written_length;
101108 }
102- return rust::Result< int >( rust:: Ok (1 ) );
109+ return rust::Ok (1 );
103110 }
104111}
You can’t perform that action at this time.
0 commit comments