a013b7
From e0361b1688c82f9fbfa07d2683effedac870ae17 Mon Sep 17 00:00:00 2001
a013b7
From: Matej Habrnal <mhabrnal@redhat.com>
a013b7
Date: Mon, 13 Feb 2017 13:12:39 +0100
a013b7
Subject: [PATCH] ccpp: add %h parameter into abrt-hook-ccpp
a013b7
a013b7
Without this commit core_pattern's parameter %h was not translated to hostname.
a013b7
a013b7
Example:
a013b7
If 'core_pattern = core.%h.%e.%p.%t' the result was
a013b7
core.%h.sleep.26284.1469805542 not core.myshostmane.sleep.26284.1469805542.
a013b7
a013b7
Related to #1364899
a013b7
a013b7
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
a013b7
---
a013b7
 src/hooks/abrt-hook-ccpp.c          | 6 +++---
a013b7
 src/hooks/abrt-install-ccpp-hook.in | 4 ++--
a013b7
 2 files changed, 5 insertions(+), 5 deletions(-)
a013b7
a013b7
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
a013b7
index 581a540..cb4d1e0 100644
a013b7
--- a/src/hooks/abrt-hook-ccpp.c
a013b7
+++ b/src/hooks/abrt-hook-ccpp.c
a013b7
@@ -161,14 +161,14 @@ static struct dump_dir *dd;
a013b7
  * %g - gid
a013b7
  * %t - UNIX time of dump
a013b7
  * %e - executable filename
a013b7
- * %I - global crash thread tid
a013b7
  * %P - global pid
a013b7
+ * %I - global crash thread tid
a013b7
+ * %h - hostname
a013b7
  * %% - output one "%"
a013b7
  */
a013b7
 /* Hook must be installed with exactly the same sequence of %c specifiers.
a013b7
- * Last one, %h, may be omitted (we can find it out).
a013b7
  */
a013b7
-static const char percent_specifiers[] = "%scpugtePI";
a013b7
+static const char percent_specifiers[] = "%scpugtePIh";
a013b7
 static char *core_basename = (char*) "core";
a013b7
 
a013b7
 static char* get_executable(pid_t pid, int *fd_p)
a013b7
diff --git a/src/hooks/abrt-install-ccpp-hook.in b/src/hooks/abrt-install-ccpp-hook.in
a013b7
index 707c57d..171bd4a 100755
a013b7
--- a/src/hooks/abrt-install-ccpp-hook.in
a013b7
+++ b/src/hooks/abrt-install-ccpp-hook.in
a013b7
@@ -11,9 +11,9 @@ SAVED_PATTERN_DIR="@VAR_RUN@/abrt"
a013b7
 SAVED_PATTERN_FILE="@VAR_RUN@/abrt/saved_core_pattern"
a013b7
 HOOK_BIN="@libexecdir@/abrt-hook-ccpp"
a013b7
 # Must match percent_specifiers[] order in abrt-hook-ccpp.c:
a013b7
-PATTERN="|$HOOK_BIN %s %c %p %u %g %t %e %P %I"
a013b7
+PATTERN="|$HOOK_BIN %s %c %p %u %g %t %e %P %I %h"
a013b7
 # Same, but with bogus "executable name" parameter
a013b7
-PATTERN1="|$HOOK_BIN %s %c %p %u %g %t e %P %I"
a013b7
+PATTERN1="|$HOOK_BIN %s %c %p %u %g %t e %P %I %h"
a013b7
 
a013b7
 # core_pipe_limit specifies how many dump_helpers can run at the same time
a013b7
 # 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing
a013b7
-- 
a013b7
1.8.3.1
a013b7