about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2014-02-25 14:56:10 +0100
committerFlorian Weimer <fweimer@redhat.com>2014-02-25 14:56:10 +0100
commit4cbf380ce948ca15a965a78f0c1a092cf5956792 (patch)
tree44f72a303346dff92c2051269b3dad3bbd4a7160 /misc
parent80a56cc3ee45d4a2a1c3ec5e67ff359a7b380fb6 (diff)
downloadglibc-4cbf380ce948ca15a965a78f0c1a092cf5956792.tar.gz
glibc-4cbf380ce948ca15a965a78f0c1a092cf5956792.tar.xz
glibc-4cbf380ce948ca15a965a78f0c1a092cf5956792.zip
misc/sys/select.h (__FD_MASK): Avoid signed integer overflow.
Shifting into the sign position is currently supported as a GCC
extension, but explicitly subjected to future changes.  Computation
in the unsigned type followed by a cast to the signed type is a GCC
extension that will be available forever.
Diffstat (limited to 'misc')
-rw-r--r--misc/sys/select.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/sys/select.h b/misc/sys/select.h
index fd13bab41a..941588d9c4 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -58,7 +58,7 @@ typedef long int __fd_mask;
 /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
 #define __NFDBITS	(8 * (int) sizeof (__fd_mask))
 #define	__FD_ELT(d)	((d) / __NFDBITS)
-#define	__FD_MASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
+#define	__FD_MASK(d)	((__fd_mask) (1UL << ((d) % __NFDBITS)))
 
 /* fd_set for select and pselect.  */
 typedef struct