MCPcopy Create free account
hub / github.com/apache/brpc / temp_file_write_all

Function temp_file_write_all

src/butil/files/temp_file.cpp:121–134  ·  view source on GitHub ↗

Write until all buffer was written or an error except EINTR. Returns: -1 error happened, errno is set count all written

Source from the content-addressed store, hash-verified

119// -1 error happened, errno is set
120// count all written
121static ssize_t temp_file_write_all(int fd, const void *buf, size_t count) {
122 size_t off = 0;
123 for (;;) {
124 ssize_t nw = write(fd, (char*)buf + off, count - off);
125 if (nw == (ssize_t)(count - off)) { // including count==0
126 return count;
127 }
128 if (nw >= 0) {
129 off += nw;
130 } else if (errno != EINTR) {
131 return -1;
132 }
133 }
134}
135
136int TempFile::save_bin(const void *buf, size_t count) {
137 if (_reopen_if_necessary() < 0) {

Callers 1

save_binMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected