Add logic to handle file context updates.

Bug: 8116902

(cherry picked from commit 527959d207b5eb852612e91efc4880bde701fd2d)

Change-Id: Ib1061e9b804e29a57116656626999cfc7b1513e4
Special case fixups for unlabled files and directories.

Bug: 8116902

(cherry picked from commit 67c2662296fc8dfa233ace58567eaeba1a646d11)

Change-Id: I2041b827240d1102060e2ec5a5de8ea1ff4e171c
Fix typo in location of seapp_contexts.

Bug: 8116902
Change-Id: I066b32029ca6631d51e1d319477f5536c4fccbd5
am 4f2b0565: Add selinux status functions from upstream libselinux.

* commit '4f2b0565ea34081dc2fd04073bb558d6b2609aef':
  Add selinux status functions from upstream libselinux.
am 7f90cf46: Merge "Eliminate a memory leak."

* commit '7f90cf46569f4ca2429b7e843c3816d816c0fd36':
  Eliminate a memory leak.
fixcon_recursive: avoid fixed size buffers

Change-Id: I980d526e999e602b6ab6ebfb7a5ddc7a4bd13785
selinux_android_reload_policy: get rid of useless temp var

Change-Id: I9d83122e276a25d2e7c928b724344d5f3420af73
am 397359d0: fixcon_recursive: avoid fixed size buffers

* commit '397359d043e5763f955b31e4421dcf15be8e3237':
  fixcon_recursive: avoid fixed size buffers
am 9c30ac60: selinux_android_reload_policy: get rid of useless temp var

* commit '9c30ac60791fe561816017c96a2931d17a7cb103':
  selinux_android_reload_policy: get rid of useless temp var
Hack to fix selinux crashes on Manta

Due to previous issues with make_ext4fs not zeroing out inode
tables and Nexus 10 not erasing partitions before flashing, some
devices during development were flashed with garbage in the
inode tables for unused inodes.  The kernel did not care, and
ignore the unused inodes, but if e2fsck ran for any reason, it
would find what it thought were lost inodes, and put them in
lost+found.

When selinux was enabled, it would reload the policy
on all files in /data, and when it traversed /lost+found, the
kernel would crash with weird ext4 errors.  We are pretty sure
this is due to bugs in the xattr code not handling potentially
bogus inodes, but we have not yet found the actual bug.  In
order to get the release out the door on time, this hack will
skip searching in lost+found directories.  This will be
fixed properly before the next release.

Bug: 8801548
Change-Id: If4cd78cf587cefa4cd2d41c4424034c5d5878b78
am 1d857f3e: Hack to fix selinux crashes on Manta

* commit '1d857f3e2e739c001b7cbbd1e37b92a038e46b98':
  Hack to fix selinux crashes on Manta
Call lsetfilecon directly in fixcon.

This avoids the spurious double-lookup from calling restorecon.

Bug: 8967715
Change-Id: I3e92804dca245501ca974bda7a0d7d1c459c58da
am 0f3a5e88: Call lsetfilecon directly in fixcon.

* commit '0f3a5e88ddc12f033edd8f3bbe0457ff2d3146e4':
  Call lsetfilecon directly in fixcon.
Revert "Call lsetfilecon directly in fixcon."

This reverts commit 0f3a5e88ddc12f033edd8f3bbe0457ff2d3146e4.
Revert "Hack to fix selinux crashes on Manta"

This reverts commit 1d857f3e2e739c001b7cbbd1e37b92a038e46b98.
am 8c6e5f8e: Revert "Call lsetfilecon directly in fixcon."

* commit '8c6e5f8ee923ef72e550d76e855a1d6f3df4b693':
  Revert "Call lsetfilecon directly in fixcon."
am dae85f9e: Revert "Hack to fix selinux crashes on Manta"

* commit 'dae85f9e3e7f0e531138a57f1b13e646b78b1919':
  Revert "Hack to fix selinux crashes on Manta"
android.c: fix free of uninitialized memory

Under certain error conditions, freecon is called with a pointer
to uninitialized memory. Make sure everything is initialized.

Move variable declaration before any goto statements. Variable
declaration after a goto statement produces weird runtime artifacts.

Change-Id: Ie1db5a8466bbf259f09a612a1c97afc3713e33df
Clean up code

Clean up the code, so it compiles with -Wall -Wextra -Werror

Change-Id: I78ad5941a45208e1a82181cedb5853753f58ff0d
am 9ca4088e: android.c: fix free of uninitialized memory

* commit '9ca4088ee4d8378e9f01df67a8df3f0cb5071bed':
  android.c: fix free of uninitialized memory