summaryrefslogtreecommitdiff
path: root/cmds/installd/utils.c
diff options
context:
space:
mode:
author Kenny Root <kroot@google.com> 2011-11-29 15:54:55 -0800
committer Kenny Root <kroot@google.com> 2011-12-01 09:07:55 -0800
commitad757e9b36d6bc6b8e39be00612d0e60863aaafc (patch)
tree47f4ed2af449ef51d817d43cc434f7edb380bf53 /cmds/installd/utils.c
parent88f10c6ce5a97b1990934148deb8ed6aa6ef7a48 (diff)
Fix free_cache to actually work
This broke with some other path-related changes, so it was scanning for /data/*/cache instead of /data/data/*/cache Also remove redundant call to restat Bug: 5686310 Change-Id: Id1661f0f1337858fc9ead53c56ab7557f421c591
Diffstat (limited to 'cmds/installd/utils.c')
-rw-r--r--cmds/installd/utils.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/cmds/installd/utils.c b/cmds/installd/utils.c
index 3099b8341f6e..a53a93ce1073 100644
--- a/cmds/installd/utils.c
+++ b/cmds/installd/utils.c
@@ -109,7 +109,7 @@ int create_persona_path(char path[PKG_PATH_MAX],
uid_len = 0;
} else {
persona_prefix = SECONDARY_USER_PREFIX;
- uid_len = snprintf(NULL, 0, "%d", persona);
+ uid_len = snprintf(NULL, 0, "%d/", persona);
}
char *dst = path;
@@ -126,7 +126,7 @@ int create_persona_path(char path[PKG_PATH_MAX],
LOGE("Error building user path");
return -1;
}
- int ret = snprintf(dst, dst_size, "%d", persona);
+ int ret = snprintf(dst, dst_size, "%d/", persona);
if (ret < 0 || (size_t) ret != uid_len) {
LOGE("Error appending persona id to path");
return -1;
@@ -135,6 +135,20 @@ int create_persona_path(char path[PKG_PATH_MAX],
return 0;
}
+int create_move_path(char path[PKG_PATH_MAX],
+ const char* pkgname,
+ const char* leaf,
+ uid_t persona)
+{
+ if ((android_data_dir.len + strlen(PRIMARY_USER_PREFIX) + strlen(pkgname) + strlen(leaf) + 1)
+ >= PKG_PATH_MAX) {
+ return -1;
+ }
+
+ sprintf(path, "%s%s%s/%s", android_data_dir.path, PRIMARY_USER_PREFIX, pkgname, leaf);
+ return 0;
+}
+
/**
* Checks whether the package name is valid. Returns -1 on error and
* 0 on success.