Merge "Add more specific error codes for uncrypt failures"
am: 3ff8a5e2a4
Change-Id: Iee5b01f59b2e0532232393c0133f0bd3b11d9ccd
This commit is contained in:
commit
6f30535229
2 changed files with 8 additions and 6 deletions
|
@ -68,6 +68,8 @@ enum UncryptErrorCode {
|
|||
kUncryptFileCloseError,
|
||||
kUncryptFileRenameError,
|
||||
kUncryptPackageMissingError,
|
||||
kUncryptRealpathFindError,
|
||||
kUncryptBlockDeviceFindError,
|
||||
};
|
||||
|
||||
#endif // _ERROR_CODE_H_
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue