Merge "Remove sdcard groups from services." into jb-mr1-dev
diff --git a/adb/adb.c b/adb/adb.c
index 95d3921..f3251fe 100644
--- a/adb/adb.c
+++ b/adb/adb.c
@@ -1024,7 +1024,13 @@
// Our external storage path may be different than apps, since
// we aren't able to bind mount after dropping root.
- setenv("EXTERNAL_STORAGE", getenv("ADB_EXTERNAL_STORAGE"), 1);
+ const char* adb_external_storage = getenv("ADB_EXTERNAL_STORAGE");
+ if (NULL != adb_external_storage) {
+ setenv("EXTERNAL_STORAGE", adb_external_storage, 1);
+ } else {
+ D("Warning: ADB_EXTERNAL_STORAGE is not set. Leaving EXTERNAL_STORAGE"
+ " unchanged.\n");
+ }
/* don't listen on a port (default 5037) if running in secure mode */
/* don't run as root if we are running in secure mode */
diff --git a/adb/commandline.c b/adb/commandline.c
index 10b2332..24cbb5a 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -965,7 +965,7 @@
argc--;
argv++;
} else {
- product = argv[1] + 2;
+ product = argv[0] + 2;
}
gProductOutPath = find_product_out_path(product);
if (gProductOutPath == NULL) {
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index 2a63905..898d452 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -157,6 +157,7 @@
char *data;
int sz;
int fd;
+ int errno_tmp;
data = 0;
fd = open(fn, O_RDONLY);
@@ -177,8 +178,10 @@
return data;
oops:
+ errno_tmp = errno;
close(fd);
if(data != 0) free(data);
+ errno = errno_tmp;
return 0;
}
#endif
@@ -313,7 +316,7 @@
kdata = load_file(kernel, &ksize);
if(kdata == 0) {
- fprintf(stderr, "cannot load '%s'\n", kernel);
+ fprintf(stderr, "cannot load '%s': %s\n", kernel, strerror(errno));
return 0;
}
@@ -333,7 +336,7 @@
if(ramdisk) {
rdata = load_file(ramdisk, &rsize);
if(rdata == 0) {
- fprintf(stderr,"cannot load '%s'\n", ramdisk);
+ fprintf(stderr,"cannot load '%s': %s\n", ramdisk, strerror(errno));
return 0;
}
}
@@ -579,7 +582,7 @@
} else {
unsigned int sz;
data = load_file(fname, &sz);
- if (data == 0) die("cannot load '%s'\n", fname);
+ if (data == 0) die("cannot load '%s': %s\n", fname, strerror(errno));
fb_queue_flash(pname, data, sz);
}
}
@@ -607,7 +610,7 @@
fb_queue_query_save("product", cur_product, sizeof(cur_product));
zdata = load_file(fn, &zsize);
- if (zdata == 0) die("failed to load '%s'", fn);
+ if (zdata == 0) die("failed to load '%s': %s", fn, strerror(errno));
zip = init_zipfile(zdata, zsize);
if(zip == 0) die("failed to access zipdata in '%s'");
@@ -677,12 +680,12 @@
fname = find_item("info", product);
if (fname == 0) die("cannot find android-info.txt");
data = load_file(fname, &sz);
- if (data == 0) die("could not load android-info.txt");
+ if (data == 0) die("could not load android-info.txt: %s", strerror(errno));
setup_requirements(data, sz);
fname = find_item("boot", product);
data = load_file(fname, &sz);
- if (data == 0) die("could not load boot.img");
+ if (data == 0) die("could not load boot.img: %s", strerror(errno));
do_send_signature(fname);
fb_queue_flash("boot", data, sz);
@@ -695,7 +698,7 @@
fname = find_item("system", product);
data = load_file(fname, &sz);
- if (data == 0) die("could not load system.img");
+ if (data == 0) die("could not load system.img: %s", strerror(errno));
do_send_signature(fname);
fb_queue_flash("system", data, sz);
}
@@ -865,7 +868,7 @@
} else if(!strcmp(*argv, "signature")) {
require(2);
data = load_file(argv[1], &sz);
- if (data == 0) die("could not load '%s'", argv[1]);
+ if (data == 0) die("could not load '%s': %s", argv[1], strerror(errno));
if (sz != 256) die("signature must be 256 bytes");
fb_queue_download("signature", data, sz);
fb_queue_command("signature", "installing signature");
diff --git a/include/diskconfig/diskconfig.h b/include/diskconfig/diskconfig.h
index d4f468c..d45b99e 100644
--- a/include/diskconfig/diskconfig.h
+++ b/include/diskconfig/diskconfig.h
@@ -19,6 +19,7 @@
#define __LIBS_DISKCONFIG_H
#include <stdint.h>
+#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
diff --git a/include/sync/sync.h b/include/sync/sync.h
index f015fa1..918acf6 100644
--- a/include/sync/sync.h
+++ b/include/sync/sync.h
@@ -42,7 +42,7 @@
};
/* timeout in msecs */
-int sync_wait(int fd, unsigned int timeout);
+int sync_wait(int fd, int timeout);
int sync_merge(const char *name, int fd1, int fd2);
struct sync_fence_info_data *sync_fence_info(int fd);
struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info,
diff --git a/init/builtins.c b/init/builtins.c
index bb963c1..aaf85d9 100644
--- a/init/builtins.c
+++ b/init/builtins.c
@@ -813,6 +813,8 @@
{
if (nargs == 2) {
return wait_for_file(args[1], COMMAND_RETRY_TIMEOUT);
- }
- return -1;
+ } else if (nargs == 3) {
+ return wait_for_file(args[1], atoi(args[2]));
+ } else
+ return -1;
}
diff --git a/init/readme.txt b/init/readme.txt
index df524a6..fe0d15d 100644
--- a/init/readme.txt
+++ b/init/readme.txt
@@ -207,6 +207,11 @@
Trigger an event. Used to queue an action from another
action.
+wait <path> [ <timeout> ]
+ Poll for the existence of the given file and return when found,
+ or the timeout has been reached. If timeout is not specified it
+ currently defaults to five seconds.
+
write <path> <string> [ <string> ]*
Open the file at <path> and write one or more strings
to it with write(2)
diff --git a/libsync/sync.c b/libsync/sync.c
index c20f15e..4892866 100644
--- a/libsync/sync.c
+++ b/libsync/sync.c
@@ -27,9 +27,9 @@
#include <sys/stat.h>
#include <sys/types.h>
-int sync_wait(int fd, unsigned int timeout)
+int sync_wait(int fd, int timeout)
{
- __u32 to = timeout;
+ __s32 to = timeout;
return ioctl(fd, SYNC_IOC_WAIT, &to);
}
diff --git a/libsync/sync_test.c b/libsync/sync_test.c
index a75f671..386747a 100644
--- a/libsync/sync_test.c
+++ b/libsync/sync_test.c
@@ -72,7 +72,7 @@
return NULL;
}
-int main(int argc, char *argv[])
+int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
{
struct sync_thread_data sync_data[4];
pthread_t threads[4];
diff --git a/libzipfile/test_zipfile.c b/libzipfile/test_zipfile.c
index 40840ec..1aaa913 100644
--- a/libzipfile/test_zipfile.c
+++ b/libzipfile/test_zipfile.c
@@ -1,5 +1,5 @@
#include <zipfile/zipfile.h>
-
+#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -55,6 +55,8 @@
switch (what)
{
+ case HUH:
+ break;
case LIST:
dump_zipfile(stdout, zip);
break;
diff --git a/toolbox/vmstat.c b/toolbox/vmstat.c
index 600f136..4086ed0 100644
--- a/toolbox/vmstat.c
+++ b/toolbox/vmstat.c
@@ -75,7 +75,7 @@
int toggle, count;
int i;
- iterations = 0;
+ iterations = -1;
delay = 1;
header_interval = 20;
@@ -119,7 +119,7 @@
if (!header_interval)
print_header();
read_state(&s[1 - toggle]);
- while ((iterations == 0) || (iterations-- > 0)) {
+ while ((iterations < 0) || (iterations-- > 0)) {
sleep(delay);
read_state(&s[toggle]);
if (header_interval) {