From 54136f8bf4d38b2cf5ac9916429f3ce5bcefea06 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 31 Mar 2022 11:26:42 -0700 Subject: [PATCH] Add a comment to explain how errno is set Since it is nontrivial which modifies `errno` is modified in ExecuteForTask(), add a comment that explains this. Bug: 213617178 Test: Compile-tested only. Change-Id: I49ce9c8054fdc59e61b2e5f9ffe6f16743a94401 Signed-off-by: Bart Van Assche --- libprocessgroup/task_profiles.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libprocessgroup/task_profiles.cpp b/libprocessgroup/task_profiles.cpp index 7a04100ac..27060aed5 100644 --- a/libprocessgroup/task_profiles.cpp +++ b/libprocessgroup/task_profiles.cpp @@ -215,6 +215,9 @@ bool SetAttributeAction::ExecuteForTask(int tid) const { return false; } } + // The PLOG() statement below uses the error code stored in `errno` by + // WriteStringToFile() because access() only overwrites `errno` if it fails + // and because this code is only reached if the access() function returns 0. PLOG(ERROR) << "Failed to write '" << value_ << "' to " << path; return false; }