summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorShawn Paul Landden <shawn@churchofgit.com>2014-12-29 11:05:19 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-12-29 11:05:19 -0500
commit96ce74918fc9f535fc04d53e960862cdeb995222 (patch)
tree261a24a2b2067c8a8a6ec329e82852a05580b672 /src/shared
parent9d06e6560812229dc20a841057f2dc9d4f346723 (diff)
util: fix strict aliasing violations in use of struct inotify_event v5
There is alot of cleanup that will have to happen to turn on -fstrict-aliasing, but I think our code should be "correct" to the rule. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c1
-rw-r--r--src/shared/util.h10
2 files changed, 8 insertions, 3 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index e58e51561b..6ef53b05ef 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -37,7 +37,6 @@
#include <linux/tiocl.h>
#include <termios.h>
#include <stdarg.h>
-#include <sys/inotify.h>
#include <poll.h>
#include <ctype.h>
#include <sys/prctl.h>
diff --git a/src/shared/util.h b/src/shared/util.h
index 8cdb79cd8f..402203e0dd 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -31,6 +31,7 @@
#include <stddef.h>
#include <unistd.h>
#include <sys/socket.h>
+#include <sys/inotify.h>
#include "time-util.h"
#include "missing.h"
@@ -463,6 +464,11 @@ int execute_command(const char *command, char *const argv[]);
#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)
#define FOREACH_INOTIFY_EVENT(e, buffer, sz) \
- for ((e) = (struct inotify_event*) (buffer); \
- (uint8_t*) (e) < (uint8_t*) (buffer) + (sz); \
+ for ((e) = &buffer.ev; \
+ (uint8_t*) (e) < (uint8_t*) (buffer.raw) + (sz); \
(e) = (struct inotify_event*) ((uint8_t*) (e) + sizeof(struct inotify_event) + (e)->len))
+
+union inotify_event_buffer {
+ struct inotify_event ev;
+ uint8_t raw[INOTIFY_EVENT_MAX];
+};