From 918e5c6fca30b432a9e04de868c73791c9955ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 23 Apr 2021 22:41:19 +0200 Subject: [PATCH] zed.d/*-notify.sh: use mktemp instead of generating temp path manually MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Tony Hutter Signed-off-by: Ahelenia ZiemiaƄska Closes #11935 --- cmd/zed/zed.d/data-notify.sh | 2 +- cmd/zed/zed.d/generic-notify.sh | 2 +- cmd/zed/zed.d/scrub_finish-notify.sh | 2 +- cmd/zed/zed.d/statechange-notify.sh | 2 +- cmd/zed/zed.d/trim_finish-notify.sh | 2 +- 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 639b459bdd..792d30a66d 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 e438031a08..1db26980c1 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 2145a100a3..5c0124b8d7 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 f46080a032..76f09061c5 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 5075302997..8fdb64531d 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