MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / WriteStringToFd

Function WriteStringToFd

Bcore/src/main/cpp/android-base/file.cpp:81–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81bool WriteStringToFd(const std::string& content, int fd) {
82 const char* p = content.data();
83 size_t left = content.size();
84 while (left > 0) {
85 ssize_t n = TEMP_FAILURE_RETRY(write(fd, p, left));
86 if (n == -1) {
87 return false;
88 }
89 p += n;
90 left -= n;
91 }
92 return true;
93}
94
95static bool CleanUpAfterFailedWrite(const std::string& path) {
96 // Something went wrong. Let's not leave a corrupt file lying around.

Callers 1

WriteStringToFileFunction · 0.85

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected