summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Craig <rpcraig@tycho.ncsc.mil>2013-03-26 15:42:41 -0400
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-07-18 20:38:39 +0100
commit911cbea54fe75341069c66d300e35ad9bde0e591 (patch)
tree502fb96788fac96493c72bbb16bf5b06937dc479
parent44677e46395555657a59a42a374c325135fc4beb (diff)
downloadsystem_core-911cbea54fe75341069c66d300e35ad9bde0e591.zip
system_core-911cbea54fe75341069c66d300e35ad9bde0e591.tar.gz
system_core-911cbea54fe75341069c66d300e35ad9bde0e591.tar.bz2
Correct run-as with seinfo parsing capability.
Change-Id: I874ccf70bf4d113e294eeb3b7fa5ca7324ad52b3
-rw-r--r--run-as/package.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/run-as/package.c b/run-as/package.c
index a836acf..b964647 100644
--- a/run-as/package.c
+++ b/run-as/package.c
@@ -48,14 +48,14 @@
* This function always zero-terminate the destination buffer unless
* 'dstlen' is 0, even in case of overflow.
*/
-static void
+static const char*
string_copy(char* dst, size_t dstlen, const char* src, size_t srclen)
{
const char* srcend = src + srclen;
const char* dstend = dst + dstlen;
if (dstlen == 0)
- return;
+ return src;
dstend--; /* make room for terminating zero */
@@ -63,6 +63,7 @@ string_copy(char* dst, size_t dstlen, const char* src, size_t srclen)
*dst++ = *src++;
*dst = '\0'; /* zero-terminate result */
+ return src;
}
/* Open 'filename' and map it into our address-space.
@@ -485,7 +486,7 @@ get_package_info(const char* pkgName, PackageInfo *info)
if (q == p)
goto BAD_FORMAT;
- string_copy(info->dataDir, sizeof info->dataDir, p, q - p);
+ p = string_copy(info->dataDir, sizeof info->dataDir, p, q - p);
/* skip spaces */
if (parse_spaces(&p, end) < 0)