equal
deleted
inserted
replaced
|
1 #include <stdlib.h> |
1 #include "dl.h" |
2 #include "dl.h" |
2 |
3 |
3 /* shameless stolen from |
4 /* shameless stolen from |
4 * http://uberhip.com/people/godber/interception/html/slide_6.html |
5 * http://uberhip.com/people/godber/interception/html/slide_6.html |
5 * and of course from the manpage of dlopen(3) |
6 * and of course from the manpage of dlopen(3) |
10 { |
11 { |
11 static int (*orig)(const char*); |
12 static int (*orig)(const char*); |
12 int rc; |
13 int rc; |
13 |
14 |
14 if (!orig) |
15 if (!orig) |
15 orig = get_original_function("libc.so.6", "puts"); |
16 orig = lib_function("puts", NULL); |
16 |
17 |
17 (*orig)("<puts>"); |
18 (*orig)("<puts>"); |
18 rc = (*orig)(s); |
19 rc = (*orig)(s); |
19 (*orig)("</puts>"); |
20 (*orig)("</puts>"); |
20 return rc; |
21 return rc; |