summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-09-25 15:31:47 -0700
committerTom Cherry <tomcherry@google.com>2019-09-25 15:33:34 -0700
commitfabba633985e271c9a50dc3ec2e5398576b7c28b (patch)
treeac3df76fbbf1bf0a600a93ea853bfefc3debd627
parent16e39c46b8a101dd1bea1d499ffe7743b8e841cc (diff)
downloadextras-fabba633985e271c9a50dc3ec2e5398576b7c28b.tar.gz
puncture_fs: convert to C++ and update for logwrapper
This was logwrapper's last C dependency to convert it to C++ for the incoming updates. Test: builds Change-Id: I71feb31032b6b4c8c7147d2111f9a685c0351e4b
-rw-r--r--puncture_fs/Android.bp2
-rw-r--r--puncture_fs/puncture_fs.cpp (renamed from puncture_fs/puncture_fs.c)6
2 files changed, 4 insertions, 4 deletions
diff --git a/puncture_fs/Android.bp b/puncture_fs/Android.bp
index 194f78f6..5c163372 100644
--- a/puncture_fs/Android.bp
+++ b/puncture_fs/Android.bp
@@ -15,7 +15,7 @@
cc_binary {
name: "puncture_fs",
- srcs: ["puncture_fs.c"],
+ srcs: ["puncture_fs.cpp"],
cflags: [
"-Wall",
"-Werror",
diff --git a/puncture_fs/puncture_fs.c b/puncture_fs/puncture_fs.cpp
index dbb4efce..9c01e3b0 100644
--- a/puncture_fs/puncture_fs.c
+++ b/puncture_fs/puncture_fs.cpp
@@ -143,7 +143,7 @@ static bool puncture_fs (const char * const path, const u64 total_size,
u64 starting_max = 0;
u64 ending_max = increments;
char stay_dir[FILENAME_MAX], delete_dir[FILENAME_MAX];
- char *rm_bin_argv[] = { "/system/bin/rm", "-rf", ""};
+ const char* rm_bin_argv[] = { "/system/bin/rm", "-rf", ""};
u64 file_id = 1;
char *base_file_data;
u64 i = 0;
@@ -190,8 +190,8 @@ static bool puncture_fs (const char * const path, const u64 total_size,
fprintf(stderr, "\rSTAGE 2/2: 0%% Complete");
free(base_file_data);
rm_bin_argv[2] = delete_dir;
- if (android_fork_execvp_ext(ARRAY_SIZE(rm_bin_argv), rm_bin_argv,
- NULL, 1, LOG_KLOG, 0, NULL, NULL, 0) < 0) {
+ if (logwrap_fork_execvp(ARRAY_SIZE(rm_bin_argv), rm_bin_argv, nullptr,
+ false, LOG_KLOG, false, nullptr) < 0) {
fprintf(stderr, "\nFailed to delete %s\n", rm_bin_argv[2]);
return false;
}