auto import from //branches/cupcake_rel/...@140373
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index e220dbe..498b4a6 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -138,6 +138,7 @@
 {
     if(!(vendor_id && (info->dev_vendor == vendor_id)) &&
        (info->dev_vendor != 0x18d1) &&
+       (info->dev_vendor != 0x0451) &&
        (info->dev_vendor != 0x0bb4)) return -1;
     if(info->ifc_class != 0xff) return -1;
     if(info->ifc_subclass != 0x42) return -1;
diff --git a/rootdir/etc/init.goldfish.rc b/rootdir/etc/init.goldfish.rc
index 96480f3..569555c 100644
--- a/rootdir/etc/init.goldfish.rc
+++ b/rootdir/etc/init.goldfish.rc
@@ -39,9 +39,7 @@
     oneshot
 
 service qemud /system/bin/qemud
-    socket qemud_gsm     stream 666
-    socket qemud_gps     stream 666
-    socket qemud_control stream 666
+    socket qemud    stream 666
     oneshot
 
 # -Q is a special logcat option that forces the
diff --git a/rootdir/init.rc b/rootdir/init.rc
index a0d6c54..ef7c28b 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -138,6 +138,7 @@
     chown system system /sys/class/leds/keyboard-backlight/brightness
     chown system system /sys/class/leds/lcd-backlight/brightness
     chown system system /sys/class/leds/button-backlight/brightness
+    chown system system /sys/class/leds/jogball-backlight/brightness
     chown system system /sys/class/leds/red/brightness
     chown system system /sys/class/leds/green/brightness
     chown system system /sys/class/leds/blue/brightness
diff --git a/vold/blkdev.c b/vold/blkdev.c
index 981d0f2..3167507 100644
--- a/vold/blkdev.c
+++ b/vold/blkdev.c
@@ -134,8 +134,12 @@
         struct dos_partition part;
         int part_no = blk->minor -1;
 
-        dos_partition_dec(block + DOSPARTOFF + part_no * sizeof(struct dos_partition), &part);
-        blk->part_type = part.dp_typ;
+        if (part_no < 4) {
+            dos_partition_dec(block + DOSPARTOFF + part_no * sizeof(struct dos_partition), &part);
+            blk->part_type = part.dp_typ;
+        } else {
+            LOGW("Skipping partition %d", part_no);
+        }
     }
 
  out:
diff --git a/vold/format.c b/vold/format.c
index dd0515c..3383949 100755
--- a/vold/format.c
+++ b/vold/format.c
@@ -37,15 +37,14 @@
     devpath = blkdev_get_devpath(part);
 
     if (!strcmp(type, FORMAT_TYPE_FAT32)) {
-        char *args[7];
+        char *args[6];
         args[0] = MKDOSFS_PATH;
-        args[1] = "-F 32";
-        args[2] = "-c 32";
-        args[3] = "-n 2";
-        args[4] = "-O android";
-        args[5] = devpath;
-        args[6] = NULL;
-        rc = logwrap(6, args);
+        args[1] = "-c 32";
+        args[2] = "-n 2";
+        args[3] = "-O android";
+        args[4] = devpath;
+        args[5] = NULL;
+        rc = logwrap(5, args);
     } else {
         char *args[7];
         args[0] = MKE2FS_PATH;
diff --git a/vold/logwrapper.c b/vold/logwrapper.c
index 25d2281..2900f2e 100644
--- a/vold/logwrapper.c
+++ b/vold/logwrapper.c
@@ -93,7 +93,7 @@
     argv_child[argc] = NULL;
 
     // XXX: PROTECT FROM VIKING KILLER
-    if (execvp(argv_child[0], argv_child)) {
+    if (execv(argv_child[0], argv_child)) {
         LOG(LOG_ERROR, "logwrapper",
             "executing %s failed: %s", argv_child[0], strerror(errno));
         exit(-1);
diff --git a/vold/misc.c b/vold/misc.c
index 951414c..0f8f61e 100644
--- a/vold/misc.c
+++ b/vold/misc.c
@@ -59,11 +59,11 @@
 	close(fd);
 	return buffer;
 }
-char *truncate_sysfs_path(char *path, int num_elements_to_remove, char *buffer)
+char *truncate_sysfs_path(char *path, int num_elements_to_remove, char *buffer, int buffer_size)
 {
     int i;
 
-    strcpy(buffer, path);
+    strncpy(buffer, path, buffer_size);
 
     for (i = 0; i < num_elements_to_remove; i++) {
         char *p = &buffer[strlen(buffer)-1];
@@ -81,7 +81,7 @@
     char *p;
     ssize_t sz;
 
-    sprintf(filename, "/sys%s/%s", devpath, var);
+    snprintf(filename, sizeof(filename), "/sys%s/%s", devpath, var);
     p = read_file(filename, &sz);
     p[(strlen(p) - 1)] = '\0';
     strncpy(buffer, p, maxlen);
diff --git a/vold/uevent.c b/vold/uevent.c
index d16f315..cfb5786 100644
--- a/vold/uevent.c
+++ b/vold/uevent.c
@@ -239,9 +239,9 @@
 static int handle_powersupply_event(struct uevent *event)
 {
     char *ps_type = get_uevent_param(event, "POWER_SUPPLY_TYPE");
-    char *ps_cap = get_uevent_param(event, "POWER_SUPPLY_CAPACITY");
 
     if (!strcasecmp(ps_type, "battery")) {
+        char *ps_cap = get_uevent_param(event, "POWER_SUPPLY_CAPACITY");
         int capacity = atoi(ps_cap);
   
         if (capacity < 5)
@@ -307,7 +307,7 @@
         return -EINVAL;
     }
 
-    truncate_sysfs_path(event->path, n, mediapath);
+    truncate_sysfs_path(event->path, n, mediapath, sizeof(mediapath));
 
     if (!(media = media_lookup_by_path(mediapath, false))) {
 #if DEBUG_UEVENT
diff --git a/vold/vold.h b/vold/vold.h
index 0876bec..4ff690a 100644
--- a/vold/vold.h
+++ b/vold/vold.h
@@ -89,7 +89,7 @@
 int switch_bootstrap(void);
 
 void *read_file(char *filename, ssize_t *_size);
-char *truncate_sysfs_path(char *path, int num_elements_to_remove, char *buffer);
+char *truncate_sysfs_path(char *path, int num_elements_to_remove, char *buffer, int buffer_size);
 char *read_sysfs_var(char *buffer, size_t maxlen, char *devpath, char *var);
 
 void ums_hostconnected_set(boolean connected);
diff --git a/vold/volmgr.c b/vold/volmgr.c
index 7c4c077..17c9a49 100644
--- a/vold/volmgr.c
+++ b/vold/volmgr.c
@@ -43,7 +43,7 @@
 static boolean safe_mode = true;
 
 static struct volmgr_fstable_entry fs_table[] = {
-    { "ext3", ext_identify, ext_check, ext_mount , true },
+//    { "ext3", ext_identify, ext_check, ext_mount , true },
     { "vfat", vfat_identify, vfat_check, vfat_mount , false },
     { NULL, NULL, NULL, NULL , false}
 };