From 6b1c483cf764abef9eb9eb9ea7a96a85d9d5d608 Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Sat, 23 Oct 2021 14:24:50 +0100 Subject: [PATCH] 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. --- spa/plugins/v4l2/v4l2-udev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spa/plugins/v4l2/v4l2-udev.c b/spa/plugins/v4l2/v4l2-udev.c index 00f161259..24adab704 100644 --- a/spa/plugins/v4l2/v4l2-udev.c +++ b/spa/plugins/v4l2/v4l2-udev.c @@ -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) {