Add core file name validation in core manager
Move the core file name validation from dreport to core manager.
systemd-coredump creates temporary file in core file path prior
to actual core file creation.
This check will help to limit dump creation only for the new core files.
Change-Id: I196d3f372d85aae0a7a36ba7171e6bfd2ff4991b
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/tools/dreport b/tools/dreport
index 0b5f77b..41b53d7 100755
--- a/tools/dreport
+++ b/tools/dreport
@@ -336,21 +336,13 @@
# https://github.com/systemd/systemd/blob/master/src/coredump/coredump.c
# /var/lib/systemd/coredump/core.%s.%s." SD_ID128_FORMAT_STR “.
# <process ID>.%s000000"
-# Added additional check to make sure that user provided in
-# systemd-coredump format.
function set_pid()
{
- #from coredump.c file.
- CORE_BASE_STRING="/var/lib/systemd/coredump/core"
-
#Escape bash characters in file name
file=$(printf %q "$optional_file")
- string=$(echo $file | awk -F . '{ print $1}')
- if [ "$CORE_BASE_STRING" = "$string" ]; then
- #matching systemd-coredump core file format.
- core_pid=$(echo $file | awk -F . '{ print $5}')
- fi
+ #matching systemd-coredump core file format.
+ core_pid=$(echo $file | awk -F . '{ print $5}')
}
# @brief Capture debug data based on the input command array.