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
diff --git a/modules/sensors/dynamic_sensor/ConnectionDetector.cpp b/modules/sensors/dynamic_sensor/ConnectionDetector.cpp
index 85b9901..99dab5b 100644
--- a/modules/sensors/dynamic_sensor/ConnectionDetector.cpp
+++ b/modules/sensors/dynamic_sensor/ConnectionDetector.cpp
@@ -194,9 +194,9 @@
}
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;