aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-04-23 22:41:19 +0200
committerBrian Behlendorf <[email protected]>2021-04-30 15:04:33 -0700
commit8dca000040bd82cebd2c184d219836b7884ddf56 (patch)
tree52cddaf772f8c988aa5aaddf0cd816fe877e897e /cmd/zed
parent71def603cd984780db45cf6ca93a3f24548d4eac (diff)
zed.d/*-notify.sh: use mktemp instead of generating temp path manually
Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11935
Diffstat (limited to 'cmd/zed')
-rwxr-xr-xcmd/zed/zed.d/data-notify.sh2
-rwxr-xr-xcmd/zed/zed.d/generic-notify.sh2
-rwxr-xr-xcmd/zed/zed.d/scrub_finish-notify.sh2
-rwxr-xr-xcmd/zed/zed.d/statechange-notify.sh2
-rwxr-xr-xcmd/zed/zed.d/trim_finish-notify.sh2
5 files changed, 5 insertions, 5 deletions
diff --git a/cmd/zed/zed.d/data-notify.sh b/cmd/zed/zed.d/data-notify.sh
index 639b459bd..792d30a66 100755
--- a/cmd/zed/zed.d/data-notify.sh
+++ b/cmd/zed/zed.d/data-notify.sh
@@ -25,7 +25,7 @@ zed_rate_limit "${rate_limit_tag}" || exit 3
umask 077
note_subject="ZFS ${ZEVENT_SUBCLASS} error for ${ZEVENT_POOL} on $(hostname)"
-note_pathname="${TMPDIR:="/tmp"}/$(basename -- "$0").${ZEVENT_EID}.$$"
+note_pathname="$(mktemp)"
{
echo "ZFS has detected a data error:"
echo
diff --git a/cmd/zed/zed.d/generic-notify.sh b/cmd/zed/zed.d/generic-notify.sh
index e438031a0..1db26980c 100755
--- a/cmd/zed/zed.d/generic-notify.sh
+++ b/cmd/zed/zed.d/generic-notify.sh
@@ -31,7 +31,7 @@ umask 077
pool_str="${ZEVENT_POOL:+" for ${ZEVENT_POOL}"}"
host_str=" on $(hostname)"
note_subject="ZFS ${ZEVENT_SUBCLASS} event${pool_str}${host_str}"
-note_pathname="${TMPDIR:="/tmp"}/$(basename -- "$0").${ZEVENT_EID}.$$"
+note_pathname="$(mktemp)"
{
echo "ZFS has posted the following event:"
echo
diff --git a/cmd/zed/zed.d/scrub_finish-notify.sh b/cmd/zed/zed.d/scrub_finish-notify.sh
index 2145a100a..5c0124b8d 100755
--- a/cmd/zed/zed.d/scrub_finish-notify.sh
+++ b/cmd/zed/zed.d/scrub_finish-notify.sh
@@ -41,7 +41,7 @@ fi
umask 077
note_subject="ZFS ${ZEVENT_SUBCLASS} event for ${ZEVENT_POOL} on $(hostname)"
-note_pathname="${TMPDIR:="/tmp"}/$(basename -- "$0").${ZEVENT_EID}.$$"
+note_pathname="$(mktemp)"
{
echo "ZFS has finished a ${action}:"
echo
diff --git a/cmd/zed/zed.d/statechange-notify.sh b/cmd/zed/zed.d/statechange-notify.sh
index f46080a03..76f09061c 100755
--- a/cmd/zed/zed.d/statechange-notify.sh
+++ b/cmd/zed/zed.d/statechange-notify.sh
@@ -37,7 +37,7 @@ fi
umask 077
note_subject="ZFS device fault for pool ${ZEVENT_POOL_GUID} on $(hostname)"
-note_pathname="${TMPDIR:="/tmp"}/$(basename -- "$0").${ZEVENT_EID}.$$"
+note_pathname="$(mktemp)"
{
if [ "${ZEVENT_VDEV_STATE_STR}" = "FAULTED" ] ; then
echo "The number of I/O errors associated with a ZFS device exceeded"
diff --git a/cmd/zed/zed.d/trim_finish-notify.sh b/cmd/zed/zed.d/trim_finish-notify.sh
index 507530299..8fdb64531 100755
--- a/cmd/zed/zed.d/trim_finish-notify.sh
+++ b/cmd/zed/zed.d/trim_finish-notify.sh
@@ -19,7 +19,7 @@ zed_check_cmd "${ZPOOL}" || exit 9
umask 077
note_subject="ZFS ${ZEVENT_SUBCLASS} event for ${ZEVENT_POOL} on $(hostname)"
-note_pathname="${TMPDIR:="/tmp"}/$(basename -- "$0").${ZEVENT_EID}.$$"
+note_pathname="$(mktemp)"
{
echo "ZFS has finished a trim:"
echo