summaryrefslogtreecommitdiffstats
path: root/uncrypt/uncrypt.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-07-27 23:29:17 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-07-27 23:29:17 +0200
commit3ff8a5e2a418201c3a4b9086de8e4dfe87265d53 (patch)
tree665c691f2f755286eaf7bb416170be77b52d1188 /uncrypt/uncrypt.cpp
parentMerge "roots.cpp: Clean up format_volume()." (diff)
parentAdd more specific error codes for uncrypt failures (diff)
downloadandroid_bootable_recovery-3ff8a5e2a418201c3a4b9086de8e4dfe87265d53.tar
android_bootable_recovery-3ff8a5e2a418201c3a4b9086de8e4dfe87265d53.tar.gz
android_bootable_recovery-3ff8a5e2a418201c3a4b9086de8e4dfe87265d53.tar.bz2
android_bootable_recovery-3ff8a5e2a418201c3a4b9086de8e4dfe87265d53.tar.lz
android_bootable_recovery-3ff8a5e2a418201c3a4b9086de8e4dfe87265d53.tar.xz
android_bootable_recovery-3ff8a5e2a418201c3a4b9086de8e4dfe87265d53.tar.zst
android_bootable_recovery-3ff8a5e2a418201c3a4b9086de8e4dfe87265d53.zip
Diffstat (limited to 'uncrypt/uncrypt.cpp')
-rw-r--r--uncrypt/uncrypt.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index 07d183be2..35998bcba 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