diff options
author | Tianjie Xu | 2017-07-27 13:42:17 -0500 |
---|---|---|
committer | Tianjie Xu | 2017-07-27 16:28:18 -0500 |
commit | 8b8e23d5cc38d4f9139b3b3cdca4a9c5ec51139e (patch) | |
tree | 12d15e93e6c1a3c3440573b225c942ae9a7cae28 /uncrypt/uncrypt.cpp | |
parent | 231c627a5527b92ae3d043e454e949cdfc4f38ea (diff) | |
download | platform-bootable-recovery-8b8e23d5cc38d4f9139b3b3cdca4a9c5ec51139e.tar.gz platform-bootable-recovery-8b8e23d5cc38d4f9139b3b3cdca4a9c5ec51139e.tar.xz platform-bootable-recovery-8b8e23d5cc38d4f9139b3b3cdca4a9c5ec51139e.zip |
Add more specific error codes for uncrypt failures
Add the error codes when we fail to find the realpath, or fail to find
the block_device.
Bug: 63737759
Test: mma
Change-Id: Icf15368ad3e7345c747d9083da2f049cc8acd571
Diffstat (limited to 'uncrypt/uncrypt.cpp')
-rw-r--r-- | uncrypt/uncrypt.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp index 07d183be..35998bcb 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* | |||
448 | static int uncrypt(const char* input_path, const char* map_file, const int socket) { | 448 | static int uncrypt(const char* input_path, const char* map_file, const int socket) { |
449 | LOG(INFO) << "update package is \"" << input_path << "\""; | 449 | LOG(INFO) << "update package is \"" << input_path << "\""; |
450 | 450 | ||
451 | // Turn the name of the file we're supposed to convert into an | 451 | // Turn the name of the file we're supposed to convert into an absolute path, so we can find |
452 | // absolute path, so we can find what filesystem it's on. | 452 | // what filesystem it's on. |
453 | char path[PATH_MAX+1]; | 453 | char path[PATH_MAX+1]; |
454 | if (realpath(input_path, path) == NULL) { | 454 | if (realpath(input_path, path) == nullptr) { |
455 | PLOG(ERROR) << "failed to convert \"" << input_path << "\" to absolute path"; | 455 | PLOG(ERROR) << "failed to convert \"" << input_path << "\" to absolute path"; |
456 | return 1; | 456 | return kUncryptRealpathFindError; |
457 | } | 457 | } |
458 | 458 | ||
459 | bool encryptable; | 459 | bool encryptable; |
460 | bool encrypted; | 460 | bool encrypted; |
461 | const char* blk_dev = find_block_device(path, &encryptable, &encrypted); | 461 | const char* blk_dev = find_block_device(path, &encryptable, &encrypted); |
462 | if (blk_dev == NULL) { | 462 | if (blk_dev == nullptr) { |
463 | LOG(ERROR) << "failed to find block device for " << path; | 463 | LOG(ERROR) << "failed to find block device for " << path; |
464 | return 1; | 464 | return kUncryptBlockDeviceFindError; |
465 | } | 465 | } |
466 | 466 | ||
467 | // If the filesystem it's on isn't encrypted, we only produce the | 467 | // If the filesystem it's on isn't encrypted, we only produce the |