summaryrefslogtreecommitdiffstats
path: root/cmds/installd/installd.c
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-09-07 13:58:28 -0700
committerKenny Root <kroot@google.com>2010-09-07 14:35:47 -0700
commit3e319a9962434e1fae86b2180ad210170f02c152 (patch)
tree741d7c4c3d9b4ebf0ea1260621609ba4ad6052f1 /cmds/installd/installd.c
parent2cb3e83654c99e202c170d9d0237d8d1f4054354 (diff)
downloadframeworks_base-3e319a9962434e1fae86b2180ad210170f02c152.zip
frameworks_base-3e319a9962434e1fae86b2180ad210170f02c152.tar.gz
frameworks_base-3e319a9962434e1fae86b2180ad210170f02c152.tar.bz2
Allow installd to handle large partitions
Use int64_t because we're RPCing over to Java which uses a Long to represent the filesystem space. Change-Id: I842b2cf9f2ff8f980ff5895c1c8eb9ebefa1ea31
Diffstat (limited to 'cmds/installd/installd.c')
-rw-r--r--cmds/installd/installd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 882c493..c991845 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -60,7 +60,7 @@ static int do_rename(char **arg, char reply[REPLY_MAX])
static int do_free_cache(char **arg, char reply[REPLY_MAX]) /* TODO int:free_size */
{
- return free_cache(atoi(arg[0])); /* free_size */
+ return free_cache((int64_t)atoll(arg[0])); /* free_size */
}
static int do_rm_cache(char **arg, char reply[REPLY_MAX])
@@ -75,15 +75,19 @@ static int do_protect(char **arg, char reply[REPLY_MAX])
static int do_get_size(char **arg, char reply[REPLY_MAX])
{
- int codesize = 0;
- int datasize = 0;
- int cachesize = 0;
+ int64_t codesize = 0;
+ int64_t datasize = 0;
+ int64_t cachesize = 0;
int res = 0;
/* pkgdir, apkpath */
res = get_size(arg[0], arg[1], arg[2], &codesize, &datasize, &cachesize, atoi(arg[3]));
- sprintf(reply,"%d %d %d", codesize, datasize, cachesize);
+ /*
+ * Each int64_t can take up 22 characters printed out. Make sure it
+ * doesn't go over REPLY_MAX in the future.
+ */
+ snprintf(reply, REPLY_MAX, "%" PRId64 " %" PRId64 " %" PRId64, codesize, datasize, cachesize);
return res;
}