changeset 0 | 7d3c07f8acfb |
child 1 | 9ccc1574a367 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/puts.c Thu Dec 23 00:46:07 2010 +0100 @@ -0,0 +1,21 @@ +#include "dl.h" + +/* shameless stolen from + * http://uberhip.com/people/godber/interception/html/slide_6.html + * and of course from the manpage of dlopen(3) + */ + + +int puts(const char* s) +{ + static int (*orig)(const char*); + int rc; + + if (!orig) + orig = get_original_function("libc.so.6", "puts"); + + (*orig)("<puts>"); + rc = (*orig)(s); + (*orig)("</puts>"); + return rc; +}