From 383444085a28cfefcfc1d145462a0d124f373ebd Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 25 Aug 2015 16:33:50 -0700 Subject: [PATCH] Not all filesystems support setting SELinux labels. Bug: http://b/23530370 Change-Id: Ie4deb3544304754696f049d17b12168cad4a51fd --- adb/file_sync_service.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/adb/file_sync_service.cpp b/adb/file_sync_service.cpp index 6ca8ba1e3..3793b8e4f 100644 --- a/adb/file_sync_service.cpp +++ b/adb/file_sync_service.cpp @@ -71,6 +71,7 @@ static bool secure_mkdirs(const std::string& path) { if (chown(partial_path.c_str(), uid, gid) == -1) { return false; } + // Not all filesystems support setting SELinux labels. http://b/23530370. selinux_android_restorecon(partial_path.c_str(), 0); } } @@ -166,10 +167,8 @@ static bool handle_send_file(int s, const char* path, uid_t uid, goto fail; } - if (selinux_android_restorecon(path, 0) == -1) { - SendSyncFailErrno(s, "selinux_android_restorecon failed"); - goto fail; - } + // Not all filesystems support setting SELinux labels. http://b/23530370. + selinux_android_restorecon(path, 0); // fchown clears the setuid bit - restore it if present. // Ignore the result of calling fchmod. It's not supported