summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2022-10-07 11:28:47 -0700
committerChristopher Ferris <cferris@google.com>2022-10-13 12:39:44 -0700
commit8b0619b47dcfb49e2269691439cb4c6a33bbb00b (patch)
tree76d737b940c2c40ccb92603b58814d2fe928c277
parentdcbe8650b6ac75485dacd38f66263373c6e4bf82 (diff)
downloadlibhardware-8b0619b47dcfb49e2269691439cb4c6a33bbb00b.tar.gz
Modify a data structure into a union.
The new 6.0 kernel headers changed all variable length structures from [0] to []. This causes a clang warning to trigger, so rewrite the affected data structure using a union to avoid having a variable sized array in the middle of the structure. Test: Builds. Change-Id: I60c6d31a93566c4aa9f7501f39f88543ee76ce91
-rw-r--r--modules/sensors/dynamic_sensor/ConnectionDetector.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/sensors/dynamic_sensor/ConnectionDetector.cpp b/modules/sensors/dynamic_sensor/ConnectionDetector.cpp
index 85b99017..99dab5b0 100644
--- a/modules/sensors/dynamic_sensor/ConnectionDetector.cpp
+++ b/modules/sensors/dynamic_sensor/ConnectionDetector.cpp
@@ -194,9 +194,9 @@ void FileConnectionDetector::handleInotifyData(ssize_t len, const char *data) {
}
bool FileConnectionDetector::readInotifyData() {
- struct {
+ union {
struct inotify_event ev;
- char padding[NAME_MAX + 1];
+ char raw[sizeof(inotify_event) + NAME_MAX + 1];
} buffer;
bool ret = true;