adb: do not chown/chmod files pushed to sdcard

Commit "adb: configure /system file permission with fs_config" can cause
'Operation not permitted' errors when pushing files to sdcard because
chown and chmod are not allowed. Omit chown and chmod operations if the
destination directory has sdcard in the group name.

Change-Id: I05767a2699b152392b4ff1606194826285cbcb1e
adbd: Don't close/reopen FFS ep0 on disconnect

In case of bulk read/write failure or disconnect, transport_usb
calls usb_ffs_kick in order to force the daemon to re-open the
FunctionFS ep files as a way to soft restart the kernel driver.

However, there's no reason to always close the ep0 file, as it
would need to be reopened and the descriptors rewritten--this
is unnecessary, especially in the simple/frequent case of cable
disconnect, and causes the kernel driver to unbind and bind *all*
of the function drivers. This is causing USB Chapter 9 tests to fail.

Thus, try to reuse the same ep0 file handle across reconnects. In
case there is a failure, the ep1/ep2 opens would fail and all the
file handles get dropped. For the adb root case, the entire daemon
gets restarted anyway.

CRs-fixed: 571846
Change-Id: I0840085c52a0795dcb2d751c39aa4a436c039ee2
Fix a bunch of small system/core bugs.

Missing frees in:
  adb/file_sync_client.c
  fastboot/fastboot.c
  libsparse/output_file.c

Missing closedirs in:
  adb/file_sync_service.c
  cpio/mkbootfs.c
  libcutils/dir_hash.c

Potential buffer overrun in:
  gpttool/gpttool.c

Incorrect NULL check in:
  libsparse/backed_block.c

Bug: https://code.google.com/p/android/issues/detail?id=61564
Change-Id: If97838a9e73a77aef7f416c31c237ce1fca4ce21
Merge branch 'kitkat' of https://github.com/KylinMod/android_system_core; branch 'cm-11.0' of git://github.com/CyanogenMod/android_system_core into kitkat