summaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/install.cpp b/install.cpp
index 518337fef..015f8f6ce 100644
--- a/install.cpp
+++ b/install.cpp
@@ -37,8 +37,6 @@
#include "minui/minui.h"
#include "minzip/SysUtil.h"
#include "minzip/Zip.h"
-#include "mtdutils/mounts.h"
-#include "mtdutils/mtdutils.h"
#include "roots.h"
#include "ui.h"
#include "verifier.h"
@@ -196,13 +194,13 @@ try_update_binary(const char* path, ZipArchive* zip, bool* wipe_cache,
// update attempt.
//
- const char** args = (const char**)malloc(sizeof(char*) * 6);
+ const char* args[6];
args[0] = binary;
args[1] = EXPAND(RECOVERY_API_VERSION); // defined in Android.mk
- char* temp = (char*)malloc(10);
- sprintf(temp, "%d", pipefd[1]);
+ char temp[16];
+ snprintf(temp, sizeof(temp), "%d", pipefd[1]);
args[2] = temp;
- args[3] = (char*)path;
+ args[3] = path;
args[4] = retry_count > 0 ? "retry" : NULL;
args[5] = NULL;
@@ -210,7 +208,7 @@ try_update_binary(const char* path, ZipArchive* zip, bool* wipe_cache,
if (pid == 0) {
umask(022);
close(pipefd[0]);
- execv(binary, (char* const*)args);
+ execv(binary, const_cast<char**>(args));
fprintf(stdout, "E:Can't run %s (%s)\n", binary, strerror(errno));
_exit(-1);
}