No description
Find a file
Tom Cherry ef52ae14ab 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 53089aa25c)
2017-04-19 16:39:08 +00:00
adb libcutils: compile with BOARD_VNDK_VERSION current 2017-04-17 12:18:36 -07:00
adf libadfhwc: Fix adf_hwc_close 2017-03-02 17:40:16 +00:00
base libbase: fix build breakage 2017-04-14 11:23:36 -07:00
bootstat bootstat: Report the total bootloader time. 2017-02-16 11:53:03 -08:00
cpio Possible null pointer miss on realloc 2017-03-23 22:41:14 +01:00
debuggerd debuggerd_test: remove useless pipe. 2017-04-04 21:22:12 -07:00
demangle Use the clang format 2 space as default. 2017-03-14 13:06:19 -07:00
fastboot Move "fastboot oem" to std::string. 2017-03-15 09:40:28 -07:00
fs_mgr libcutils: compile with BOARD_VNDK_VERSION current 2017-04-17 12:18:36 -07:00
gatekeeperd gatekeeper HAL uses "default" service name 2017-02-23 19:31:59 +00:00
healthd Merge "healthd: Implement scheduleUpdate" am: 6edabc75ab am: c0405200b8 2017-03-23 01:12:17 +00:00
include Merge "Moved include/backtrace to libbacktrace/include" into oc-dev 2017-04-13 16:53:13 +00:00
init init: Use std::string for write_file() 2017-04-19 16:39:08 +00:00
libappfuse Retry write operation when getting ENOBUFS. 2017-03-31 01:50:50 +00:00
libbacktrace Merge "libbacktrace: make vendor_available" into oc-dev 2017-04-14 17:59:29 +00:00
libbinderwrapper Convert libbinderwrapper_test_support to be a static library 2017-03-03 17:14:04 -08:00
libcrypto_utils Rely on the platform -std default. 2016-10-10 14:31:12 -07:00
libcutils Merge "Allocate a GID range for external cache files." into oc-dev 2017-04-18 20:03:22 +00:00
libdiskconfig liblog: use log/log.h when utilizing ALOG macros 2017-01-11 09:31:15 -08:00
libgrallocusage libgrallocusage: use gralloc1.h usage flags 2017-04-10 09:47:34 -07:00
libion liblog: use log/log.h when utilizing ALOG macros 2017-01-11 09:31:15 -08:00
liblog libcutils: compile with BOARD_VNDK_VERSION current 2017-04-17 12:18:36 -07:00
libmemtrack libmemtrack: check return value for getMemory() 2017-02-27 12:21:39 -08:00
libmemunreachable liblog: use log/log.h when utilizing ALOG macros 2017-01-11 09:31:15 -08:00
libmetricslogger port metrics_logger to v2 format 2017-02-28 17:35:56 -05:00
libnativebridge NativeBridge: add "linked namespace" semantic corresponding to linker 2017-04-07 10:42:51 -07:00
libnativeloader NativeBridge: add "linked namespace" semantic corresponding to linker 2017-04-07 10:42:51 -07:00
libnetutils liblog: use log/log.h when utilizing ALOG macros 2017-01-11 09:31:15 -08:00
libpackagelistparser liblog: use log/log.h when utilizing ALOG macros 2017-01-11 09:31:15 -08:00
libpixelflinger liblog: use log/log.h when utilizing ALOG macros 2017-01-11 09:31:15 -08:00
libprocessgroup add killProcessGroupOnce 2017-03-30 14:17:09 -07:00
libprocinfo Enable more modules on linux_bionic builds 2017-03-15 15:44:00 -07:00
libsparse Remove "_host" and "_static" suffix from libsparse definition. am: b0c395955d am: 7b8d66e7cc am: 11b65cf3be 2017-01-12 22:45:52 +00:00
libsuspend resolve merge conflicts of a45b1d6f3 to master 2017-01-11 11:41:38 -08:00
libsync libsync: ndk: Fix compilation in C mode. 2017-04-14 15:12:06 -07:00
libsystem Revert "libsystem_headers: export libaudio_system_headers" 2017-04-14 21:02:49 +00:00
libsysutils There's no longer a limit to property names. 2017-02-28 14:12:54 -08:00
libunwindstack Use the 2 space clang format for libunwindstack. 2017-03-21 10:41:45 -07:00
libusbhost Merge "usblib: Wrap USBDEVFS_REAPURBNDELAY ioctl" 2016-10-27 16:15:12 +00:00
libutils Merge "libutils: include what you use" into oc-dev 2017-04-14 18:58:01 +00:00
libziparchive Fix out of bound read in libziparchive am: d9fd1863f4 am: 6908996434 am: 25c0d68d29 am: ed33065bfc am: bc8c8e4b56 am: afddaba0cc am: 0b1ad23070 am: d4b4f0a1e1 2017-04-11 20:11:24 +00:00
lmkd liblog: use log/log.h when utilizing ALOG macros 2017-01-11 09:31:15 -08:00
logcat logcatd: introduce logcatd executable 2017-04-05 19:35:07 +00:00
logd logd: regression in handling watermark boundary. 2017-04-18 07:19:23 -07:00
logwrapper Merge "logwrapper: add a benchmark for android_fork_execvp_ext" 2017-03-23 11:56:10 +00:00
mkbootimg mkbootimg: use int for os_version and os_patch_level 2016-03-29 16:06:37 -07:00
reboot Convert more Android.mk files to Android.bp 2016-07-13 17:41:45 -07:00
rootdir init: handle sys.powerctl immediately 2017-04-18 12:24:58 -07:00
run-as Define range of GIDs for cached app data. 2016-12-13 13:28:08 -07:00
sdcard Make sdcardfs the default 2017-03-20 13:11:10 -07:00
storaged storaged: stop binder threads before exiting 2017-04-04 19:44:01 +00:00
toolbox Revert "Only allow system to write to existing input nodes." 2017-02-21 17:12:59 +00:00
trusty trusty: use log/log.h for ALOG macros 2017-01-13 07:30:11 -08:00
tzdatacheck Update to support staging behavior 2017-03-31 17:41:56 +01:00
.clang-format Add a 2 width option of clang format. 2017-03-10 13:01:39 -08:00
.clang-format-2 Remove extraneous .clang-format files 2017-03-14 14:06:31 -07:00
.clang-format-4 Remove extraneous .clang-format files 2017-03-14 14:06:31 -07:00
.gitignore Ignore adb/*.pyc files 2015-08-11 12:59:58 -07:00
Android.bp Export android_filesystem_config.h as a filegroup 2017-01-17 18:20:28 -08:00
Android.mk Remove the simulator target from all makefiles. 2011-07-11 22:12:32 -07:00
CleanSpec.mk init.rc: have hwservicemanager start the HAL class 2016-09-26 00:23:51 -07:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2013-07-30 13:56:49 -07:00
NOTICE Fix omission in NOTICE file. 2013-07-30 13:56:55 -07:00
PREUPLOAD.cfg Add a PREUPLOAD.cfg file to run git-clang-format on every commit 2017-03-08 16:51:26 +08:00