# HG changeset patch # User Bruno Haible # Date 1298415663 -3600 # Node ID e514f670d50866be53a2f8d98301001436f2ae85 # Parent c19d2aef45e793c58716d3b0f613dff0f2e4c645 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 . diff --git a/ChangeLog b/ChangeLog --- 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 --- a/lib/ioctl.c +++ b/lib/ioctl.c @@ -37,7 +37,9 @@ 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 */