am 1ce12d39: am 43f43d87: Merge "Move adb\'s selinux_android_restorecon up and check for failures."

* commit '1ce12d397f1f563ee3eac4c1fdb907909d6eeff1':
  Move adb's selinux_android_restorecon up and check for failures.
diff --git a/adb/file_sync_service.cpp b/adb/file_sync_service.cpp
index 6e072a6..ae9e096 100644
--- a/adb/file_sync_service.cpp
+++ b/adb/file_sync_service.cpp
@@ -166,9 +166,14 @@
             goto fail;
         }
 
-         // fchown clears the setuid bit - restore it if present.
-         // Ignore the result of calling fchmod. It's not supported
-         // by all filesystems. b/12441485
+        if (selinux_android_restorecon(path, 0) == -1) {
+            SendSyncFailErrno(s, "selinux_android_restorecon failed");
+            goto fail;
+        }
+
+        // fchown clears the setuid bit - restore it if present.
+        // Ignore the result of calling fchmod. It's not supported
+        // by all filesystems. b/12441485
         fchmod(fd, mode);
     }
 
@@ -201,8 +206,6 @@
 
     adb_close(fd);
 
-    selinux_android_restorecon(path, 0);
-
     utimbuf u;
     u.actime = timestamp;
     u.modtime = timestamp;