Don't let XFD_SETSIZE exceed FD_SETSIZE

This fixes 2c94cdb453 on the Hurd, as
FD_SETSIZE is only 256, and so anyone using XFD_SETSIZE to iterate over
the contents of an fd_set will overrun the array.

Signed-off-by: James Clarke <jrtc27@jrtc27.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
James Clarke 2016-04-25 17:12:08 +01:00 committed by Adam Jackson
parent edc04f87c7
commit de30673937

View file

@ -67,10 +67,13 @@ typedef long fd_mask;
# endif
#endif
#define XFD_SETSIZE 512
#ifndef FD_SETSIZE
#define FD_SETSIZE XFD_SETSIZE
#if defined(FD_SETSIZE) && FD_SETSIZE < 512
# define XFD_SETSIZE FD_SETSIZE
#else
# define XFD_SETSIZE 512
# ifndef FD_SETSIZE
# define FD_SETSIZE XFD_SETSIZE
# endif
#endif
#ifndef NBBY