From ae8550fd20c3e6f3778f156bfaccba3a7ae161cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= Date: Fri, 10 Sep 2021 10:51:08 +0200 Subject: [PATCH] Replace security_context_t type security_context_t has been marked as deprecated in libselinux from version 3.2. Update to the `char*` type. Bug: 190808996 Test: m Change-Id: I6f40e161251c79893d41e12c368715736578aacc --- Utils.cpp | 10 +++++----- Utils.h | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Utils.cpp b/Utils.cpp index 4635975..f9f3058 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -68,10 +68,10 @@ using android::base::unique_fd; namespace android { namespace vold { -security_context_t sBlkidContext = nullptr; -security_context_t sBlkidUntrustedContext = nullptr; -security_context_t sFsckContext = nullptr; -security_context_t sFsckUntrustedContext = nullptr; +char* sBlkidContext = nullptr; +char* sBlkidUntrustedContext = nullptr; +char* sFsckContext = nullptr; +char* sFsckUntrustedContext = nullptr; bool sSleepOnUnmount = true; @@ -702,7 +702,7 @@ static status_t ReadLinesFromFdAndLog(std::vector* output, } status_t ForkExecvp(const std::vector& args, std::vector* output, - security_context_t context) { + char* context) { auto argv = ConvertToArgv(args); android::base::unique_fd pipe_read, pipe_write; diff --git a/Utils.h b/Utils.h index a3316c3..bb6615c 100644 --- a/Utils.h +++ b/Utils.h @@ -38,10 +38,10 @@ static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_iso static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled"; /* SELinux contexts used depending on the block device type */ -extern security_context_t sBlkidContext; -extern security_context_t sBlkidUntrustedContext; -extern security_context_t sFsckContext; -extern security_context_t sFsckUntrustedContext; +extern char* sBlkidContext; +extern char* sBlkidUntrustedContext; +extern char* sFsckContext; +extern char* sFsckUntrustedContext; // TODO remove this with better solution, b/64143519 extern bool sSleepOnUnmount; @@ -104,8 +104,8 @@ status_t ReadMetadataUntrusted(const std::string& path, std::string* fsType, std std::string* fsLabel); /* Returns either WEXITSTATUS() status, or a negative errno */ -status_t ForkExecvp(const std::vector& args, std::vector* output = nullptr, - security_context_t context = nullptr); +status_t ForkExecvp(const std::vector& args, + std::vector* output = nullptr, char* context = nullptr); pid_t ForkExecvpAsync(const std::vector& args);