opa-fm/0001-Fix-well-known-tempfile-issue-in-script.patch

30 lines
887 B
Diff

From 5dfa99291d5702abf1a00aa7c396295e019ca5f2 Mon Sep 17 00:00:00 2001
From: Honggang Li <honli@redhat.com>
Date: Thu, 19 Oct 2017 14:47:19 +0800
Subject: [PATCH] Fix well-known tempfile issue in script
---
Esm/ib/src/linux/startup/sm_capture.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Esm/ib/src/linux/startup/sm_capture.sh b/Esm/ib/src/linux/startup/sm_capture.sh
index fda2e1f..a284486 100755
--- a/Esm/ib/src/linux/startup/sm_capture.sh
+++ b/Esm/ib/src/linux/startup/sm_capture.sh
@@ -38,8 +38,10 @@ SM_EXEC=/usr/lib/opa-fm/runtime/sm
IFS_FM_BASE=/usr/lib/opa-fm
PROGNAME="$0"
-dirName="smdump-"`date '+%d%b%y%H%M%S'`
-dumpLocation="/tmp/$dirName"
+# Hedge against bash vs. sh
+dateStr=`date '+%d%b%y%H%M%S'`
+dumpLocation="`mktemp -d /tmp/smdump-${dateStr}-XXXXXX`"
+dirName=`basename $dumpLocation`
usage() {
echo "Usage:"
--
2.14.0