1Remove __assert_fail() 2 3The netplug code uses the assert() macro in various places. In glibc 4internally, assert() uses a function called __assert_fail() to print a 5message and abort. Relying on internal glibc details, netplug 6re-defines __assert_fail() in the hope that it will get called instead 7of glibc internal version. 8 9This attempt: 10 11 * Doesn't work with uClibc, which doesn't use any __assert_fail() 12 function at all. It doesn't fail to build, but it is entirely 13 useless. 14 15 * Fails to build with musl, which also defines __assert_fail(), but 16 with a different prototype. 17 18We simply remove the __assert_fail() implementation, so that the C 19library implementation of assert() just does its normal work. The only 20functionality lost is that the message is displayed on the standard 21output rather than in netplug's logs (and this was only working with 22glibc anyway). 23 24Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 25 26Index: b/lib.c 27=================================================================== 28--- a/lib.c 29+++ b/lib.c 30@@ -199,21 +199,6 @@ 31 return x; 32 } 33 34- 35-void 36-__assert_fail(const char *assertion, const char *file, 37- unsigned int line, const char *function) 38-{ 39- do_log(LOG_CRIT, "%s:%u: %s%sAssertion `%s' failed", 40- file, line, 41- function ? function : "", 42- function ? ": " : "", 43- assertion); 44- 45- abort(); 46-} 47- 48- 49 /* 50 * Local variables: 51 * c-file-style: "stroustrup" 52