summaryrefslogtreecommitdiff
path: root/base/errors_unix.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2017-03-31 15:47:33 -0700
committerWei Wang <wvw@google.com>2017-04-19 16:39:08 +0000
commitef52ae14abaf091b1bece89656d80850b497e084 (patch)
tree47023c8db5a3c49ee6061e6c07a6566feed0f24a /base/errors_unix.cpp
parent79af3c6d6ab288982b7f140663a7ad17619e8802 (diff)
init: Use std::string for write_file()
The content parameter of write_file() previously took a char* that was then converted to a std::string in WriteStringToFd(). One unfortunate effect of this, is that it is impossible to write data that contains '\0' within it, as the new string will only contain characters up until the '\0'. This changes write_file() to take an std::string, such that std::string::size() is used to determine the length of the string, allowing it to contain null characters. Also change the path parameter of read_file() and write_file() for consistency. Lastly, add a test for handling strings with '\0' in them. Bug: 36726045 Bug: 36576280 Test: Boot bullhead, run unit tests Change-Id: Idad60e4228ee2de741ab3ab6a4917065b5e63cd8 (cherry picked from commit 53089aa25ca9707e22e45e862f794bfc958d302a)
Diffstat (limited to 'base/errors_unix.cpp')
0 files changed, 0 insertions, 0 deletions