Fix write and read-write ioctls on certain 64-bit OS
Using int as the operation parameter was wrong. It meant any write or RW ioctls (which have the MSB set) would be sign-extended to 64-bit when calling the native API. Depending on the OS, the upper 32 bits were not cleared prior to comparing with the call number, resulting in unexpected errors. Linux and FreeBSD operated properly; I only got the error on Darwin. Change-Id: Iaf4157b7efa2416d898cfffd14d985af65c1ff89 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
parent
f4e0ffb11c
commit
feb2415363
@ -165,7 +165,7 @@ static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SO
|
||||
|
||||
// VxWorks' headers specify 'int' instead of '...' for the 3rd ioctl() parameter.
|
||||
template <typename T>
|
||||
static inline int qt_safe_ioctl(int sockfd, int request, T arg)
|
||||
static inline int qt_safe_ioctl(int sockfd, unsigned long request, T arg)
|
||||
{
|
||||
#ifdef Q_OS_VXWORKS
|
||||
return ::ioctl(sockfd, request, (int) arg);
|
||||
|
Loading…
Reference in New Issue
Block a user