Add installd command to create /data/misc user dir
New command 'mkuser <id>' sets up a user directory in /data/misc/user/,
readable by all apps within that user and writeable by the local system
process.
Change-Id: I5ddde8c4a80f606e723bb41aa64581a0720842d5
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 886fd3b..34a5353 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -265,27 +265,40 @@
return 0;
}
-int delete_user(userid_t userid)
+int create_user(userid_t userid)
{
- char data_path[PKG_PATH_MAX];
- if (create_user_path(data_path, userid)) {
- return -1;
- }
- if (delete_dir_contents(data_path, 1, NULL)) {
- return -1;
- }
-
- char media_path[PATH_MAX];
- if (create_user_media_path(media_path, userid) == -1) {
- return -1;
- }
- if (delete_dir_contents(media_path, 1, NULL) == -1) {
+ if (ensure_config_user_dirs(userid) == -1) {
return -1;
}
return 0;
}
+int delete_user(userid_t userid)
+{
+ int status = 0;
+
+ char data_path[PKG_PATH_MAX];
+ if ((create_user_path(data_path, userid) != 0)
+ || (delete_dir_contents(data_path, 1, NULL) != 0)) {
+ status = -1;
+ }
+
+ char media_path[PATH_MAX];
+ if ((create_user_media_path(media_path, userid) != 0)
+ || (delete_dir_contents(media_path, 1, NULL) != 0)) {
+ status = -1;
+ }
+
+ char config_path[PATH_MAX];
+ if ((create_user_config_path(config_path, userid) != 0)
+ || (delete_dir_contents(config_path, 1, NULL) != 0)) {
+ status = -1;
+ }
+
+ return status;
+}
+
int delete_cache(const char *pkgname, userid_t userid)
{
char cachedir[PKG_PATH_MAX];