Mercurial > pidgin
diff src/prefix.c @ 10251:645eb9804040
[gaim-migrate @ 11391]
This lets us register a fallback function, so we can do binreloc methods
2 and 3 without messing with prefix.c.
This is already in autopackage cvs.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Tue, 23 Nov 2004 20:25:22 +0000 |
parents | c143a3fac58d |
children | b98f856e2e5e |
line wrap: on
line diff
--- a/src/prefix.c Tue Nov 23 06:37:42 2004 +0000 +++ b/src/prefix.c Tue Nov 23 20:25:22 2004 +0000 @@ -63,6 +63,25 @@ #include <unistd.h> +static br_locate_fallback_func fallback_func = NULL; +static void *fallback_data = NULL; +/** + * br_set_fallback_function: + * func: A function to call to find the binary. + * data: User data to pass to func. + * + * Sets a function to call to find the path to the binary, in + * case "/proc/self/maps" can't be opened. The function set should + * return a string that is safe to free with free(). + */ +void +br_set_locate_fallback_func (br_locate_fallback_func func, void *data) +{ + fallback_func = func; + fallback_data = data; +} + + /** * br_locate: * symbol: A symbol that belongs to the app/library you want to locate. @@ -104,8 +123,12 @@ br_return_val_if_fail (symbol != NULL, NULL); f = fopen ("/proc/self/maps", "r"); - if (!f) - return NULL; + if (!f) { + if (fallback_func) + return fallback_func(symbol, fallback_data); + else + return NULL; + } while (!feof (f)) {