summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-07-27 23:37:33 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-07-27 23:37:33 +0200
commitce47e3792fec84106697f7e3f1d520bb3447524b (patch)
tree8728c91145cc4a37fb3315a3c8d39e8efaf5326d
parentMerge "roots.cpp: Clean up format_volume()." am: 8eef26cf3d am: dcd272fbb1 (diff)
parentMerge "Add more specific error codes for uncrypt failures" am: 3ff8a5e2a4 (diff)
downloadandroid_bootable_recovery-ce47e3792fec84106697f7e3f1d520bb3447524b.tar
android_bootable_recovery-ce47e3792fec84106697f7e3f1d520bb3447524b.tar.gz
android_bootable_recovery-ce47e3792fec84106697f7e3f1d520bb3447524b.tar.bz2
android_bootable_recovery-ce47e3792fec84106697f7e3f1d520bb3447524b.tar.lz
android_bootable_recovery-ce47e3792fec84106697f7e3f1d520bb3447524b.tar.xz
android_bootable_recovery-ce47e3792fec84106697f7e3f1d520bb3447524b.tar.zst
android_bootable_recovery-ce47e3792fec84106697f7e3f1d520bb3447524b.zip
Diffstat (limited to '')
-rw-r--r--error_code.h2
-rw-r--r--uncrypt/uncrypt.cpp12
2 files changed, 8 insertions, 6 deletions
diff --git a/error_code.h b/error_code.h
index 9fe047c91..4cbad4cfe 100644
--- a/error_code.h
+++ b/error_code.h
@@ -68,6 +68,8 @@ enum UncryptErrorCode {
kUncryptFileCloseError,
kUncryptFileRenameError,
kUncryptPackageMissingError,
+ kUncryptRealpathFindError,
+ kUncryptBlockDeviceFindError,
};
#endif // _ERROR_CODE_H_
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index ad3bdce7a..7a2ccbc7c 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -448,20 +448,20 @@ static int produce_block_map(const char* path, const char* map_file, const char*
static int uncrypt(const char* input_path, const char* map_file, const int socket) {
LOG(INFO) << "update package is \"" << input_path << "\"";
- // Turn the name of the file we're supposed to convert into an
- // absolute path, so we can find what filesystem it's on.
+ // Turn the name of the file we're supposed to convert into an absolute path, so we can find
+ // what filesystem it's on.
char path[PATH_MAX+1];
- if (realpath(input_path, path) == NULL) {
+ if (realpath(input_path, path) == nullptr) {
PLOG(ERROR) << "failed to convert \"" << input_path << "\" to absolute path";
- return 1;
+ return kUncryptRealpathFindError;
}
bool encryptable;
bool encrypted;
const char* blk_dev = find_block_device(path, &encryptable, &encrypted);
- if (blk_dev == NULL) {
+ if (blk_dev == nullptr) {
LOG(ERROR) << "failed to find block device for " << path;
- return 1;
+ return kUncryptBlockDeviceFindError;
}
// If the filesystem it's on isn't encrypted, we only produce the