[PATCH:xdm 1/2] Add a cast to avoid a compiler error.
Thomas Klausner
wiz at NetBSD.org
Fri Jun 28 10:35:38 PDT 2013
gcc-4.5.4 on NetBSD complains:
xdm/prngc.c: In function ‘get_prngd_bytes’:
xdm/prngc.c:133:2: error: passing argument 1 of ‘atomicio’ from incompatible pointer type
xdm/prngc.c:46:16: note: expected ‘ssize_t (*)(int, void *, size_t)’ but argument is of type ‘ssize_t (*)(int, const void *, size_t)’
The problem is that the read(2) and write(2) syscalls differ
in the const-ness of their second argument.
Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
xdm/prngc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xdm/prngc.c b/xdm/prngc.c
index f0db8eb..fe737e3 100644
--- a/xdm/prngc.c
+++ b/xdm/prngc.c
@@ -130,7 +130,7 @@ reopen:
msg[0] = 0x02;
msg[1] = len;
- if (atomicio(write, fd, msg, sizeof(msg)) != sizeof(msg)) {
+ if (atomicio((ssize_t (*)(int, void *, size_t))write, fd, msg, sizeof(msg)) != sizeof(msg)) {
if (errno == EPIPE && errors < 10) {
close(fd);
errors++;
--
1.8.3.1
More information about the xorg-devel
mailing list