diff options
author | Roland McGrath <roland@gnu.org> | 2002-04-02 04:43:06 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-04-02 04:43:06 +0000 |
commit | db6b51ada724d76d2d8a4b80dfbc20235fcdb0e7 (patch) | |
tree | 9e2e39ac4a7cce6940f61c195ccdd26dc4895ae0 /hurd/hurdselect.c | |
parent | 96c4df505528ff3a5ca8f9377481bc928be547de (diff) | |
download | glibc-db6b51ada724d76d2d8a4b80dfbc20235fcdb0e7.tar glibc-db6b51ada724d76d2d8a4b80dfbc20235fcdb0e7.tar.gz glibc-db6b51ada724d76d2d8a4b80dfbc20235fcdb0e7.tar.bz2 glibc-db6b51ada724d76d2d8a4b80dfbc20235fcdb0e7.zip |
* hurd/hurdselect.c (_hurd_select): Fix
MACH_MSG_TYPE_INTEGER_T -> integer_t in sizeof.
Use a union rather than casts to compare mach_msg_type_t as int.
2002-03-25 Roland McGrath <roland@frob.com>
* hurd/hurdchdir.c (_hurd_change_directory_port_from_name): Don't
check off the end of NAME when it's shorter than 2 chars.
Reported by Ognyan Kulev <ogi@fmi.uni-sofia.bg>.
2002-03-17 Roland McGrath <roland@frob.com>
* sysdeps/mach/hurd/i386/sys/io.h: New file.
* sysdeps/mach/hurd/i386/ioperm.c: New file.
* sysdeps/mach/hurd/i386/Dist: Add them.
* sysdeps/mach/hurd/i386/Versions
(libc: GLIBC_2.2.6): New set, add ioperm.
* sysdeps/mach/configure.in: New check to set HAVE_I386_IO_PERM_MODIFY.
(mach_interface_list): Check for mach_i386.defs.
* config.h.in (HAVE_I386_IO_PERM_MODIFY): #undef it.
* sysdeps/mach/configure: Regenerated.
Diffstat (limited to 'hurd/hurdselect.c')
-rw-r--r-- | hurd/hurdselect.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c index 68dc746925..544eee9cb5 100644 --- a/hurd/hurdselect.c +++ b/hurd/hurdselect.c @@ -64,6 +64,14 @@ _hurd_select (int nfds, } d[nfds]; sigset_t oset; + union typeword /* Use this to avoid unkosher casts. */ + { + mach_msg_type_t type; + uint32_t word; + }; + assert (sizeof (union typeword) == sizeof (mach_msg_type_t)); + assert (sizeof (uint32_t) == sizeof (mach_msg_type_t)); + if (sigmask && __sigprocmask (SIG_SETMASK, sigmask, &oset)) return -1; @@ -298,15 +306,15 @@ _hurd_select (int nfds, struct { mach_msg_header_t head; - mach_msg_type_t err_type; + union typeword err_type; error_t err; } error; struct { mach_msg_header_t head; - mach_msg_type_t err_type; + union typeword err_type; error_t err; - mach_msg_type_t result_type; + union typeword result_type; int result; } success; #endif @@ -321,15 +329,16 @@ _hurd_select (int nfds, /* We got a message. Decode it. */ #define IO_SELECT_REPLY_MSGID (21012 + 100) /* XXX */ #ifdef MACH_MSG_TYPE_BIT - const mach_msg_type_t inttype = - { MACH_MSG_TYPE_INTEGER_T, sizeof (MACH_MSG_TYPE_INTEGER_T) * 8, - 1, 1, 0, 0 }; + const union typeword inttype = + { type: + { MACH_MSG_TYPE_INTEGER_T, sizeof (integer_t) * 8, 1, 1, 0, 0 } + }; #endif - if (msg.head.msgh_id == IO_SELECT_REPLY_MSGID - && msg.head.msgh_size >= sizeof msg.error - && !(msg.head.msgh_bits & MACH_MSGH_BITS_COMPLEX) + if (msg.head.msgh_id == IO_SELECT_REPLY_MSGID && + msg.head.msgh_size >= sizeof msg.error && + !(msg.head.msgh_bits & MACH_MSGH_BITS_COMPLEX) && #ifdef MACH_MSG_TYPE_BIT - && *(int *) &msg.error.err_type == *(int *) &inttype + msg.error.err_type.word == inttype.word #endif ) { @@ -346,7 +355,7 @@ _hurd_select (int nfds, if (msg.error.err || msg.head.msgh_size != sizeof msg.success || #ifdef MACH_MSG_TYPE_BIT - *(int *) &msg.success.result_type != *(int *) &inttype || + msg.success.result_type.word != inttype.word || #endif (msg.success.result & SELECT_ALL) == 0) { |