From 1a59e495dbe68a6f5dc862f929ed38da056afbd4 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 23 Feb 2018 14:47:35 +0000 Subject: gnulib: use GCOMPAT__assert_with_reason() instead of bare assert() --- libgcompat/gnulib.c | 12 ++++++++++-- 1 file 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 #include +#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); } -- cgit v1.2.3-70-g09d2