diff options
Diffstat (limited to '')
-rw-r--r-- | tests/override_gethostname.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/override_gethostname.c b/tests/override_gethostname.c new file mode 100644 index 0000000..10a4867 --- /dev/null +++ b/tests/override_gethostname.c @@ -0,0 +1,22 @@ +// we need this for dlsym(): #include <dlfcn.h> +#include <stdio.h> + + +int gethostname(char *name, size_t __attribute__((unused)) len) +{ + *name = '\0'; + return 0; +} + +static void __attribute__((constructor)) +my_init(void) +{ + /* we currently do not need this entry point, but keep it as + * a "template". It can be used, e.g. to emit some diagnostic + * information: + printf("loaded\n"); + * or - more importantly - obtain a pointer to the overriden + * API: + orig_etry = dlsym(RTLD_NEXT, "original_entry_point"); + */ +} |