diff options
-rw-r--r-- | libgcompat/gnulib.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libgcompat/gnulib.c b/libgcompat/gnulib.c index e0ee953..ccdec24 100644 --- a/libgcompat/gnulib.c +++ b/libgcompat/gnulib.c @@ -1,8 +1,16 @@ -#include <assert.h> #include <sys/select.h> +#include "internal.h" + +#define REASON_FD_SET_OVERFLOW \ + "Fault: Overflow in fd_set detected.\n" \ + "Description: This is caused by a programmer naively attempting to redefine FD_SETSIZE,\n" \ + " which is not allowed on POSIX platforms. The program must be either rebuilt\n" \ + " with the correct FD_SETSIZE definition, or preferably rewritten to avoid use\n" \ + " of select(2) in general. See also: poll(2).\n" \ + " libgcompat believes FD_SETSIZE to be %zu.\n" unsigned long __fdelt_chk(unsigned long size) { - assert(size < FD_SETSIZE); + GCOMPAT__assert_with_reason(size < FD_SETSIZE, REASON_FD_SET_OVERFLOW, FD_SETSIZE); return size / (sizeof(unsigned long) << 3); } |