From 4a77a84a55522a3b122f9c63ef0d0b8a6a131627 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 4 Mar 2020 18:11:18 -0800 Subject: [PATCH] run-as: improve error messages. Include the relevant argument when reporting failed calls. Test: treehugger Change-Id: I49c691d9edfb825dfee22ab5eb57e7d025c08c21 --- run-as/run-as.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run-as/run-as.cpp b/run-as/run-as.cpp index 432c434b4..cc92c68d0 100644 --- a/run-as/run-as.cpp +++ b/run-as/run-as.cpp @@ -247,12 +247,12 @@ int main(int argc, char* argv[]) { std::string seinfo = std::string(info.seinfo) + ":fromRunAs"; if (selinux_android_setcontext(uid, 0, seinfo.c_str(), pkgname) < 0) { - error(1, errno, "couldn't set SELinux security context"); + error(1, errno, "couldn't set SELinux security context '%s'", seinfo.c_str()); } // cd into the data directory, and set $HOME correspondingly. if (TEMP_FAILURE_RETRY(chdir(info.data_dir)) == -1) { - error(1, errno, "couldn't chdir to package's data directory"); + error(1, errno, "couldn't chdir to package's data directory '%s'", info.data_dir); } setenv("HOME", info.data_dir, 1);