From f682b4786a4093efb23bf80d69bf80eb274b145b Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 6 Feb 2015 12:19:48 -0800 Subject: Clean up reading and writing in init. This isn't particularly useful in and of itself, but it does introduce the first (trivial) unit test, improves the documentation (including details about how to debug init crashes), and made me aware of how unpleasant the existing parser is. I also fixed a bug in passing --- unless you thought the "peboot" and "pm" commands were features... Bug: 19217569 Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de --- include/utils/file.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/utils/file.h b/include/utils/file.h index 8685ee2..a80afb1 100644 --- a/include/utils/file.h +++ b/include/utils/file.h @@ -22,8 +22,11 @@ namespace android { +bool ReadFdToString(int fd, std::string* content); bool ReadFileToString(const std::string& path, std::string* content); + bool WriteStringToFile(const std::string& content, const std::string& path); +bool WriteStringToFd(const std::string& content, int fd); #if !defined(_WIN32) bool WriteStringToFile(const std::string& content, const std::string& path, -- cgit v1.1