diff options
author | Tao Bao <tbao@google.com> | 2015-06-10 02:55:33 +0200 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-06-10 02:55:33 +0200 |
commit | b89452efa8d1a17ab67301ed87083bd12f09cf0a (patch) | |
tree | 5999b4abeaa280a75a2b8eb67a301b3d1739bac2 /uncrypt/uncrypt.cpp | |
parent | am 2cf180f6: Merge "Separate uncrypt into two modes" (diff) | |
parent | Merge "uncrypt: Write status when it reboots to factory reset" (diff) | |
download | android_bootable_recovery-b89452efa8d1a17ab67301ed87083bd12f09cf0a.tar android_bootable_recovery-b89452efa8d1a17ab67301ed87083bd12f09cf0a.tar.gz android_bootable_recovery-b89452efa8d1a17ab67301ed87083bd12f09cf0a.tar.bz2 android_bootable_recovery-b89452efa8d1a17ab67301ed87083bd12f09cf0a.tar.lz android_bootable_recovery-b89452efa8d1a17ab67301ed87083bd12f09cf0a.tar.xz android_bootable_recovery-b89452efa8d1a17ab67301ed87083bd12f09cf0a.tar.zst android_bootable_recovery-b89452efa8d1a17ab67301ed87083bd12f09cf0a.zip |
Diffstat (limited to 'uncrypt/uncrypt.cpp')
-rw-r--r-- | uncrypt/uncrypt.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp index efdbdac3c..20a272949 100644 --- a/uncrypt/uncrypt.cpp +++ b/uncrypt/uncrypt.cpp @@ -431,26 +431,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); |