From d25387b9a6a11ca552778ee96ba059fa37397755 Mon Sep 17 00:00:00 2001 From: Nicolae-Alexandru Ivan Date: Fri, 1 Aug 2014 14:57:26 +0300 Subject: [PATCH] Some minor fixes and code cleanup --- src/efs.c | 7 ++++--- src/file_utils.c | 5 +++++ src/key_chain.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/efs.c b/src/efs.c index 0ca99ae..24d1973 100644 --- a/src/efs.c +++ b/src/efs.c @@ -117,6 +117,7 @@ static int encrypt_storage(char *storage_path, char *passwd) key_storage_path); if (ret < 0) { LOGE("Error mounting %s", private_dir_path); + remove_dir(key_storage_path); return ret; } @@ -125,10 +126,9 @@ static int encrypt_storage(char *storage_path, char *passwd) LOGE("Error copy data to private storage %s", private_dir_path); /* Try to fail gracefully */ - remove_dir_content(private_dir_path); umount_ecryptfs(private_dir_path); - remove(private_dir_path); - remove(key_storage_path); + remove_dir(private_dir_path); + remove_dir(key_storage_path); return ret; } @@ -516,6 +516,7 @@ int EFS_recover_data_and_remove(char *storage_path, char *passwd) if (ret < 0) { LOGE("Error mounting private storage %s to %s", private_dir_path, recovery_path); + remove_dir(recovery_path); return ret; } diff --git a/src/file_utils.c b/src/file_utils.c index ef8e3d1..8845c7c 100644 --- a/src/file_utils.c +++ b/src/file_utils.c @@ -620,6 +620,11 @@ static int copy_files(file_info ** file_list, const char *src_path, const char * iter = iter->next; } + + ret = property_set(property, "100"); + if (ret < 0) { + LOGE("property_set"); + } return 0; } diff --git a/src/key_chain.c b/src/key_chain.c index cf2fee9..790a942 100644 --- a/src/key_chain.c +++ b/src/key_chain.c @@ -88,7 +88,7 @@ int add_ecryptfs_key(unsigned char *key, char *sig, unsigned char *salt) if (ret == -1) { ret = -errno; LOGE("Error adding key with sig %s; ret = [%d]\n : %s", sig, - errno, strerror(ret)); + errno, strerror(errno)); if (ret == -EDQUOT) LOGE("Error adding key to keyring - keyring is full\n"); return ret;