The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/198
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === There is definition for libdir in configure.ac. `AS_AC_EXPAND(LIBDIR, "$libdir")` so we could use LIBDIR in our code.  Signed-off-by: Daniel Kang <kangliang...@gmail.com>
From 9dd49ba5551b6932866320ed3d9e5fadf8a69c30 Mon Sep 17 00:00:00 2001 From: Daniel Kang <kangliang...@gmail.com> Date: Sun, 2 Jul 2017 00:23:44 +0800 Subject: [PATCH] add common fallback dlopen for liblxcfs.so Signed-off-by: Daniel Kang <kangliang...@gmail.com> --- lxcfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lxcfs.c b/lxcfs.c index fb0c05c..62cfd35 100644 --- a/lxcfs.c +++ b/lxcfs.c @@ -28,6 +28,7 @@ #include <sys/epoll.h> #include <sys/mount.h> #include <sys/socket.h> +#include <linux/limits.h> #include "bindings.h" #include "config.h" // for VERSION @@ -74,6 +75,7 @@ static volatile sig_atomic_t need_reload; * lock and when we know the user_count was 0 */ static void do_reload(void) { + char lxcfs_lib_path[PATH_MAX]; if (dlopen_handle) { lxcfs_debug("%s\n", "Closing liblxcfs.so handle."); dlclose(dlopen_handle); @@ -86,7 +88,13 @@ static void do_reload(void) goto good; } - dlopen_handle = dlopen("/usr/lib/lxcfs/liblxcfs.so", RTLD_LAZY); +#ifdef LIBDIR + /* LIBDIR: autoconf will setup this MACRO. Default value is $PREFIX/lib */ + snprintf(lxcfs_lib_path, PATH_MAX, "%s/lxcfs/liblxcfs.so", LIBDIR); +#else + snprintf(lxcfs_lib_path, PATH_MAX, "/usr/local/lib/lxcfs/liblxcfs.so"); +#endif + dlopen_handle = dlopen(lxcfs_lib_path, RTLD_LAZY); if (!dlopen_handle) { lxcfs_error("Failed to open liblxcfs.so: %s.\n", dlerror()); _exit(1);
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel