File pun.diff of Package openntpd
From: Jan Engelhardt <jengelh@inai.de>
Date: 2015-03-14 01:15:33.562266820 +0100
build: resolve a compilation warning
compat/imsg-buffer.c: In function 'msgbuf_write':
compat/imsg-buffer.c:258:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
*(int *)CMSG_DATA(cmsg) = buf->fd;
[rpmlint:
I: Program is likely to break with new gcc. Try -fno-strict-aliasing.
W: openntpd strict-aliasing-punning compat/imsg-buffer.c:258
]
CMSG_DATA yields a pointer to char, which, despite cmsghdr.cmsg_data
being aligned for int, by the standard is not guaranteed to be.
---
compat/imsg-buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: openntpd-5.7p3/compat/imsg-buffer.c
===================================================================
--- openntpd-5.7p3.orig/compat/imsg-buffer.c
+++ openntpd-5.7p3/compat/imsg-buffer.c
@@ -255,7 +255,7 @@ msgbuf_write(struct msgbuf *msgbuf)
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
- *(int *)CMSG_DATA(cmsg) = buf->fd;
+ memcpy(CMSG_DATA(cmsg), &buf->fd, sizeof(int));
}
again: