summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-11-15 17:12:31 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2010-11-15 17:12:31 +0100
commit13ecd00fcc2fe6e4104ce73d500484f517e5417b (patch)
treee13051edba80875ca216d1463bf0499d1fb6c34f
parent46d60e990d57758c1d72ed76efdeee19e55996f1 (diff)
downloadabrt-13ecd00fcc2fe6e4104ce73d500484f517e5417b.tar.gz
abrt-13ecd00fcc2fe6e4104ce73d500484f517e5417b.tar.xz
abrt-13ecd00fcc2fe6e4104ce73d500484f517e5417b.zip
abrt-handle-crashdump: prepend our libexec path to $PATH
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--src/daemon/Daemon.cpp12
-rw-r--r--src/daemon/Makefile.am1
-rw-r--r--src/daemon/abrt-handle-crashdump.c8
3 files changed, 15 insertions, 6 deletions
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp
index 72bb54bf..7d31ebac 100644
--- a/src/daemon/Daemon.cpp
+++ b/src/daemon/Daemon.cpp
@@ -840,13 +840,13 @@ int main(int argc, char** argv)
* (I saw it set only DBUS_STARTER_ADDRESS and DBUS_STARTER_BUS_TYPE).
* In this case, set something sane:
*/
- if (!getenv("PATH"))
- putenv((char*)"PATH=/usr/sbin:/usr/bin:/sbin:/bin");
-
- /* need to add LIBEXEC_DIR to PATH, because otherwise abrt-action-*
- * is not found by exec()
+ /* Need to add LIBEXEC_DIR to PATH, because otherwise abrt-action-*
+ * are not found by exec()
*/
- putenv(xasprintf("PATH=%s:%s", LIBEXEC_DIR, getenv("PATH")));
+ const char *env_path = getenv("PATH");
+ if (!env_path || !env_path[0])
+ env_path = "/usr/sbin:/usr/bin:/sbin:/bin";
+ putenv(xasprintf("PATH=%s:%s", LIBEXEC_DIR, env_path));
putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose));
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index a63c014f..86c8b3b2 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -69,6 +69,7 @@ abrt_handle_crashdump_CPPFLAGS = \
-DDEBUG_INFO_DIR=\"$(DEBUG_INFO_DIR)\" \
-DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
+ -DLIBEXEC_DIR=\"$(LIBEXEC_DIR)\" \
-D_GNU_SOURCE \
-Wall -Werror
abrt_handle_crashdump_LDADD = \
diff --git a/src/daemon/abrt-handle-crashdump.c b/src/daemon/abrt-handle-crashdump.c
index 02463ae9..2217c67a 100644
--- a/src/daemon/abrt-handle-crashdump.c
+++ b/src/daemon/abrt-handle-crashdump.c
@@ -86,6 +86,14 @@ int main(int argc, char **argv)
}
/* -e EVENT: run event */
+
+ /* Need to add LIBEXEC_DIR to PATH, because otherwise abrt-action-*
+ * are not found by exec()
+ */
+ const char *env_path = getenv("PATH");
+ if (!env_path) env_path = "";
+ putenv(xasprintf("PATH=%s%s%s", LIBEXEC_DIR, (!env_path[0] ? "" : ":"), env_path));
+
struct run_event_state *run_state = new_run_event_state();
run_state->logging_callback = do_log;
int r = run_event(run_state, dump_dir_name ? dump_dir_name : ".", event);