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 <bvanassche@google.com>
This commit is contained in:
Bart Van Assche 2022-03-31 11:26:42 -07:00
parent 48d403a511
commit 54136f8bf4
1 changed files with 3 additions and 0 deletions

View File

@ -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;
}