From 95d83dbbfafaabc980a74102f4b3d9ec9b950dd3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 23 Feb 2011 00:01:03 +0100 Subject: [PATCH] ioctl: Fix for MacOS X in 64-bit mode. * lib/ioctl.c (rpl_ioctl): Zero-extend, not sign-extend, the request value. Suggested by Eric Blake. Reported by Markus Gothe . --- ChangeLog | 8 ++++++++ lib/ioctl.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ee86ca938f..f2e9ee0a8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-02-22 Bruno Haible + + ioctl: Fix for MacOS X in 64-bit mode. + * lib/ioctl.c (rpl_ioctl): Zero-extend, not sign-extend, the request + value. + Suggested by Eric Blake. + Reported by Markus Gothe . + 2011-02-22 Jim Meyering maint: sc_cpp_indent_check: remove the "only in lib/" restriction diff --git a/lib/ioctl.c b/lib/ioctl.c index 72f9f37b18..7c09d95b49 100644 --- a/lib/ioctl.c +++ b/lib/ioctl.c @@ -37,7 +37,9 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */) buf = va_arg (args, void *); va_end (args); - return ioctl (fd, request, buf); + /* Cast 'request' so that when the system's ioctl function takes a 64-bit + request argument, the value gets zero-extended, not sign-extended. */ + return ioctl (fd, (unsigned int) request, buf); } #else /* mingw */ -- 2.30.2