From 92cd8891ffe48b417150fe392425a4c886cc00aa Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Tue, 21 Sep 2021 15:23:33 -0700 Subject: [PATCH] trusty_apploader: log to stderr Print an error message to stderr on connection failure, so that the command doesn't exit silently in case of the common user error of forgetting to run it as root. Bug: None Test: Run as regular user, see "permission denied" message. Change-Id: Ia213dedccab27e6152b5eb969fbee06d82d3d4ff --- trusty/apploader/apploader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trusty/apploader/apploader.cpp b/trusty/apploader/apploader.cpp index e4d9b390c..c72af4021 100644 --- a/trusty/apploader/apploader.cpp +++ b/trusty/apploader/apploader.cpp @@ -245,6 +245,8 @@ static ssize_t send_app_package(const char* package_file_name) { tipc_fd = tipc_connect(dev_name, APPLOADER_PORT); if (tipc_fd < 0) { LOG(ERROR) << "Failed to connect to Trusty app loader: " << strerror(-tipc_fd); + // print this to stderr too to avoid silently exiting when run as non-root + fprintf(stderr, "Failed to connect to Trusty app loader: %s\n", strerror(-tipc_fd)); rc = tipc_fd; goto err_tipc_connect; }