Merge change 1795 into donut
* changes:
Make /system/xbin/tcpdump setuid root.
diff --git a/adb/Android.mk b/adb/Android.mk
index c8606cf..6cbaf82 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -57,6 +57,8 @@
ifneq ($(USE_SYSDEPS_WIN32),)
LOCAL_SRC_FILES += sysdeps_win32.c
+else
+ LOCAL_SRC_FILES += fdevent.c
endif
LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter
@@ -98,6 +100,7 @@
LOCAL_SRC_FILES := \
adb.c \
+ fdevent.c \
transport.c \
transport_local.c \
transport_usb.c \
diff --git a/libcutils/fdevent.c b/adb/fdevent.c
similarity index 99%
rename from libcutils/fdevent.c
rename to adb/fdevent.c
index 4cf46fa..5d6fb96 100644
--- a/libcutils/fdevent.c
+++ b/adb/fdevent.c
@@ -26,7 +26,7 @@
#include <stdarg.h>
#include <stddef.h>
-#include <cutils/fdevent.h>
+#include "fdevent.h"
#define TRACE(x...) fprintf(stderr,x)
diff --git a/include/cutils/fdevent.h b/adb/fdevent.h
similarity index 100%
rename from include/cutils/fdevent.h
rename to adb/fdevent.h
diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c
index 0de0dd5..65cb20a 100644
--- a/adb/framebuffer_service.c
+++ b/adb/framebuffer_service.c
@@ -20,7 +20,7 @@
#include <string.h>
#include <fcntl.h>
-#include <cutils/fdevent.h>
+#include "fdevent.h"
#include "adb.h"
#include <linux/fb.h>
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
index e5d17a8..3c74e0f 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -169,7 +169,7 @@
extern int socket_loopback_server(int port, int type);
extern int socket_inaddr_any_server(int port, int type);
-/* normally provided by <cutils/fdevent.h> */
+/* normally provided by "fdevent.h" */
#define FDE_READ 0x0001
#define FDE_WRITE 0x0002
@@ -252,7 +252,7 @@
#else /* !_WIN32 a.k.a. Unix */
-#include <cutils/fdevent.h>
+#include "fdevent.h"
#include <cutils/sockets.h>
#include <cutils/properties.h>
#include <cutils/misc.h>
diff --git a/libcutils/Android.mk b/libcutils/Android.mk
index a43f7e3..f5e49f5 100644
--- a/libcutils/Android.mk
+++ b/libcutils/Android.mk
@@ -58,7 +58,6 @@
commonSources += \
mspace.c \
selector.c \
- fdevent.c \
tztime.c \
tzstrftime.c \
adb_networking.c \
diff --git a/vold/volmgr_vfat.c b/vold/volmgr_vfat.c
index 344a166..2b0e1fa 100644
--- a/vold/volmgr_vfat.c
+++ b/vold/volmgr_vfat.c
@@ -39,6 +39,7 @@
int vfat_check(blkdev_t *dev)
{
int rc;
+ boolean rw = true;
#if VFAT_DEBUG
LOG_VOL("vfat_check(%d:%d):", dev->major, dev->minor);
@@ -50,47 +51,51 @@
return 0;
}
-#ifdef VERIFY_PASS
- char *args[7];
- args[0] = FSCK_MSDOS_PATH;
- args[1] = "-v";
- args[2] = "-V";
- args[3] = "-w";
- args[4] = "-p";
- args[5] = blkdev_get_devpath(dev);
- args[6] = NULL;
- rc = logwrap(6, args);
- free(args[5]);
-#else
- char *args[6];
- args[0] = FSCK_MSDOS_PATH;
- args[1] = "-v";
- args[2] = "-w";
- args[3] = "-p";
- args[4] = blkdev_get_devpath(dev);
- args[5] = NULL;
- rc = logwrap(5, args);
- free(args[4]);
-#endif
+ do {
- if (rc == 0) {
- LOG_VOL("Filesystem check completed OK");
- return 0;
- } else if (rc == 1) {
- LOG_VOL("Filesystem check failed (general failure)");
- return -EINVAL;
- } else if (rc == 2) {
- LOG_VOL("Filesystem check failed (invalid usage)");
- return -EIO;
- } else if (rc == 4) {
- LOG_VOL("Filesystem check completed (errors fixed)");
- } else if (rc == 8) {
- LOG_VOL("Filesystem check failed (not a FAT filesystem)");
- return -ENODATA;
- } else {
- LOG_VOL("Filesystem check failed (unknown exit code %d)", rc);
- return -EIO;
- }
+ char *args[6];
+ args[0] = FSCK_MSDOS_PATH;
+ args[1] = "-v";
+
+ if (rw) {
+ args[2] = "-w";
+ args[3] = "-p";
+ args[4] = blkdev_get_devpath(dev);
+ args[5] = NULL;
+ rc = logwrap(5, args);
+ free(args[4]);
+ } else {
+ args[2] = "-n";
+ args[3] = blkdev_get_devpath(dev);
+ args[4] = NULL;
+ rc = logwrap(4, args);
+ free(args[3]);
+ }
+
+ if (rc == 0) {
+ LOG_VOL("Filesystem check completed OK");
+ return 0;
+ } else if (rc == 1) {
+ LOG_VOL("Filesystem check failed (general failure)");
+ return -EINVAL;
+ } else if (rc == 2) {
+ LOG_VOL("Filesystem check failed (invalid usage)");
+ return -EIO;
+ } else if (rc == 4) {
+ LOG_VOL("Filesystem check completed (errors fixed)");
+ } else if (rc == 6) {
+ LOG_VOL("Filesystem read-only - retrying check RO");
+ rw = false;
+ continue;
+ } else if (rc == 8) {
+ LOG_VOL("Filesystem check failed (not a FAT filesystem)");
+ return -ENODATA;
+ } else {
+ LOG_VOL("Filesystem check failed (unknown exit code %d)", rc);
+ return -EIO;
+ }
+ } while (0);
+
return 0;
}
@@ -113,15 +118,22 @@
flags |= MS_REMOUNT;
}
+ /*
+ * The mount masks restrict access so that:
+ * 1. The 'system' user cannot access the SD card at all -
+ * (protects system_server from grabbing file references)
+ * 2. Group users can RWX
+ * 3. Others can only RX
+ */
rc = mount(devpath, vol->mount_point, "vfat", flags,
- "utf8,uid=1000,gid=1000,fmask=711,dmask=700,shortname=mixed");
+ "utf8,uid=1000,gid=1015,fmask=702,dmask=702,shortname=mixed");
if (rc && errno == EROFS) {
LOGE("vfat_mount(%d:%d, %s): Read only filesystem - retrying mount RO",
dev->major, dev->minor, vol->mount_point);
flags |= MS_RDONLY;
rc = mount(devpath, vol->mount_point, "vfat", flags,
- "utf8,uid=1000,gid=1000,fmask=711,dmask=700,shortname=mixed");
+ "utf8,uid=1000,gid=1015,fmask=702,dmask=702,shortname=mixed");
}
#if VFAT_DEBUG