summaryrefslogtreecommitdiffstats
path: root/uncrypt
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-05-30 00:02:26 +0200
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-30 00:02:27 +0200
commit02b6472546b899ebc16029371eb75364059871d2 (patch)
treea626f37dc489f48f4d0d5b6c251e0884f53bf1a3 /uncrypt
parentReally don't use TEMP_FAILURE_RETRY with close in recovery. (diff)
parentuncrypt: Write status when it reboots to factory reset (diff)
downloadandroid_bootable_recovery-02b6472546b899ebc16029371eb75364059871d2.tar
android_bootable_recovery-02b6472546b899ebc16029371eb75364059871d2.tar.gz
android_bootable_recovery-02b6472546b899ebc16029371eb75364059871d2.tar.bz2
android_bootable_recovery-02b6472546b899ebc16029371eb75364059871d2.tar.lz
android_bootable_recovery-02b6472546b899ebc16029371eb75364059871d2.tar.xz
android_bootable_recovery-02b6472546b899ebc16029371eb75364059871d2.tar.zst
android_bootable_recovery-02b6472546b899ebc16029371eb75364059871d2.zip
Diffstat (limited to 'uncrypt')
-rw-r--r--uncrypt/uncrypt.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index 6e670a449..1db3013c6 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -427,26 +427,29 @@ int main(int argc, char** argv) {
wipe_misc();
reboot_to_recovery();
} else {
- std::string package;
+ // The pipe has been created by the system server.
+ int status_fd = open(status_file.c_str(), O_WRONLY | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR);
+ if (status_fd == -1) {
+ ALOGE("failed to open pipe \"%s\": %s\n", status_file.c_str(), strerror(errno));
+ return 1;
+ }
+
if (argc == 3) {
// when command-line args are given this binary is being used
// for debugging.
input_path = argv[1];
map_file = argv[2];
} else {
+ std::string package;
if (!find_uncrypt_package(package)) {
+ android::base::WriteStringToFd("-1\n", status_fd);
+ close(status_fd);
return 1;
}
input_path = package.c_str();
map_file = cache_block_map.c_str();
}
- // The pipe has been created by the system server.
- int status_fd = open(status_file.c_str(), O_WRONLY | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR);
- if (status_fd == -1) {
- ALOGE("failed to open pipe \"%s\": %s\n", status_file.c_str(), strerror(errno));
- return 1;
- }
int status = uncrypt(input_path, map_file, status_fd);
if (status != 0) {
android::base::WriteStringToFd("-1\n", status_fd);