OSDN Git Service

installd: a workaround for 9p filesystem
authorChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 27 Jun 2017 06:21:26 +0000 (14:21 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 10 Dec 2017 15:21:55 +0000 (23:21 +0800)
SELinux and getxattr seem not work on 9p filesystem.
Ignore the errors as a workaround.

TEST: be able to boot to Home on QEMU with shared 'data' folder.

cmds/installd/InstalldNativeService.cpp

index 8a79ee1..2789ee4 100644 (file)
@@ -252,7 +252,7 @@ static int restorecon_app_data_lazy(const std::string& path, const std::string&
     }
     if (selinux_android_restorecon_pkgdir(path.c_str(), seInfo.c_str(), uid, 0) < 0) {
         PLOG(ERROR) << "Failed top-level restorecon for " << path;
-        goto fail;
+    //  goto fail;
     }
     if (lgetfilecon(path.c_str(), &after) < 0) {
         PLOG(ERROR) << "Failed after getfilecon for " << path;
@@ -474,7 +474,7 @@ binder::Status InstalldNativeService::migrateAppData(const std::unique_ptr<std::
     auto target = (flags & FLAG_STORAGE_DE) ? de_path : ce_path;
     auto source = (flags & FLAG_STORAGE_DE) ? ce_path : de_path;
 
-    if (getxattr(target.c_str(), kXattrDefault, nullptr, 0) == -1) {
+    if (getxattr(target.c_str(), kXattrDefault, nullptr, 0) == -1 && errno != ENODATA) {
         LOG(WARNING) << "Requested default storage " << target
                 << " is not active; migrating from " << source;
         if (delete_dir_contents_and_dir(target) != 0) {