| 68 | } |
| 69 | |
| 70 | bool ReadFileToString(const std::string& path, std::string* content, bool follow_symlinks) { |
| 71 | content->clear(); |
| 72 | |
| 73 | int flags = O_RDONLY | O_CLOEXEC | O_BINARY | (follow_symlinks ? 0 : O_NOFOLLOW); |
| 74 | android_lkchan::base::unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), flags))); |
| 75 | if (fd == -1) { |
| 76 | return false; |
| 77 | } |
| 78 | return ReadFdToString(fd, content); |
| 79 | } |
| 80 | |
| 81 | bool WriteStringToFd(const std::string& content, int fd) { |
| 82 | const char* p = content.data(); |
nothing calls this directly
no test coverage detected