spa: v4l2: Convert buf structure to union and fix alignment

The inotify_event field has a variable sized type, so it's recommended to store
it at the end of the storage unit. Fixes gnu-variable-sized-type-not-at-end warning.
This commit is contained in:
Philippe Normand 2021-10-23 14:24:50 +01:00 committed by Wim Taymans
parent ec7ed1275e
commit 6b1c483cf7

View file

@ -411,9 +411,9 @@ static void impl_on_notify_events(struct spa_source *source)
{
bool deleted = false;
struct impl *this = source->data;
struct {
struct inotify_event e;
char name[NAME_MAX+1];
union {
unsigned char name[sizeof(struct inotify_event) + NAME_MAX + 1];
struct inotify_event e; /* for appropriate alignment */
} buf;
while (true) {