From: Michal Privoznik Date: Tue, 17 May 2016 13:50:27 +0000 (+0200) Subject: auto-buildrequires-preload: Use libc.so name from GNU headers X-Git-Tag: v1.3~2 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=a342db7026068baee2a52afa0ca98431b49918ec;p=autobuildrequires.git auto-buildrequires-preload: Use libc.so name from GNU headers There's this header file gnu/lib-names.h which contains stringified versions of library names such as: #define LIBC_SO "libc.so.6" Advantage of using that is whenever there's a soname bump we don't have to care about that and bare rebuild just works (TM). Signed-off-by: Michal Privoznik --- diff --git a/auto-buildrequires-preload.c b/auto-buildrequires-preload.c index a1e6773..b67e20a 100644 --- a/auto-buildrequires-preload.c +++ b/auto-buildrequires-preload.c @@ -36,6 +36,7 @@ #include #include #include +#include #define ALIAS(ret,syscall,params,brfunc) \ extern ret syscall params __attribute__((alias (brfunc))) @@ -191,9 +192,9 @@ br_init (void) { void *dl; - dl = dlopen ("/lib64/libc.so.6", RTLD_LAZY|RTLD_LOCAL); + dl = dlopen ("/lib64/" LIBC_SO, RTLD_LAZY|RTLD_LOCAL); if (dl == NULL) // Try '/lib/' also - dl = dlopen("/lib/libc.so.6", RTLD_LAZY|RTLD_LOCAL); + dl = dlopen("/lib/" LIBC_SO, RTLD_LAZY|RTLD_LOCAL); if (dl == NULL) { fprintf (stderr, "%s\n", dlerror ()); abort ();