equal
deleted
inserted
replaced
|
1 #include <string.h> |
|
2 #include <stdlib.h> |
1 #include <dirent.h> |
3 #include <dirent.h> |
2 #include "dl.h" |
4 #include "dl.h" |
3 |
5 |
4 /* shameless stolen from |
6 /* shameless stolen from |
5 * http://uberhip.com/people/godber/interception/html/slide_6.html |
7 * http://uberhip.com/people/godber/interception/html/slide_6.html |
12 |
14 |
13 static struct dirent* (*orig)(DIR *); |
15 static struct dirent* (*orig)(DIR *); |
14 struct dirent *dent; |
16 struct dirent *dent; |
15 |
17 |
16 if (!orig) |
18 if (!orig) |
17 orig = get_original_function("libc.so.6", "readdir64"); |
19 orig = lib_function("readdir64", NULL); |
18 |
20 |
19 dent = (*orig)(dirp); |
21 dent = (*orig)(dirp); |
20 |
22 |
21 /* skip selected entries */ |
23 /* skip selected entries */ |
22 if (dent && dent->d_name[0] == 'M') |
24 while (dent && strchr(dent->d_name, '.')) { |
23 dent = (*orig)(dirp); |
25 dent = (*orig)(dirp); |
|
26 } |
24 |
27 |
25 return dent; |
28 return dent; |
26 } |
29 } |