From 3f5fa9ed7f1b26c152c7702a81ef77a40a2f1372 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Wed, 20 Jul 2011 16:17:29 -0400 Subject: [PATCH] Use install path for exec() Add INSTALL_PATH define for binary execution path. Signed-off-by: David Goulet --- ltt-sessiond/Makefile.am | 2 ++ ltt-sessiond/main.c | 2 +- lttng/Makefile.am | 2 ++ lttng/lttng.c | 3 ++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ltt-sessiond/Makefile.am b/ltt-sessiond/Makefile.am index 13c272a24..9134a3e95 100644 --- a/ltt-sessiond/Makefile.am +++ b/ltt-sessiond/Makefile.am @@ -1,6 +1,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/liblttsessiondcomm \ -I$(top_srcdir)/libkernelctl -I$(top_srcdir)/libustctl +INCLUDES = -DINSTALL_PATH=\""$(bindir)"\" + AM_CFLAGS = -fno-strict-aliasing bin_PROGRAMS = ltt-sessiond diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index 8507523d3..63e99df38 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -914,7 +914,7 @@ static pid_t spawn_kconsumerd(void) /* * Exec kconsumerd. */ - execlp("ltt-kconsumerd", "ltt-kconsumerd", "--quiet", NULL); + execl(INSTALL_PATH "/ltt-kconsumerd", "ltt-kconsumerd", "--quiet", NULL); if (errno != 0) { perror("kernel start consumer exec"); } diff --git a/lttng/Makefile.am b/lttng/Makefile.am index 7a828006b..2efd94e1d 100644 --- a/lttng/Makefile.am +++ b/lttng/Makefile.am @@ -1,5 +1,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include +INCLUDES = -DINSTALL_PATH=\""$(bindir)"\" + bin_PROGRAMS = lttng lttng_SOURCES = cmd.h conf.c conf.h commands/start.c \ diff --git a/lttng/lttng.c b/lttng/lttng.c index 455b18c58..f56893365 100644 --- a/lttng/lttng.c +++ b/lttng/lttng.c @@ -336,8 +336,9 @@ static int check_sessiond(void) /* Let's rock and roll */ if (pathname == NULL) { - ret = asprintf(&alloc_pathname, "ltt-sessiond"); + ret = asprintf(&alloc_pathname, INSTALL_PATH "/ltt-sessiond"); if (ret < 0) { + perror("asprintf spawn sessiond"); goto end; } pathname = alloc_pathname; -- 2.34.1