From fd386dbeda975478af502da98a34afcec138d54e Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Tue, 30 Nov 2021 08:37:07 -0500 Subject: [PATCH] use mktemp from coreutils instead of homegrown tempdir creation --- doasedit | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/doasedit b/doasedit index 7155ebb..adcd13d 100755 --- a/doasedit +++ b/doasedit @@ -12,16 +12,8 @@ fi set -Eeuo pipefail -destfile_pfx="$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)" || true +tempdir="$(mktemp -d)" -while [ -d "/tmp/doasedit/$destfile_pfx" ]; do - destfile_pfx="$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32)" -done - -tempdir="/tmp/doasedit/$destfile_pfx" - -# we don't want any other users to be able to read what we're doing, so -m700 -mkdir -m700 -p $tempdir trap "rm -rf $tempdir" EXIT srcfile="$(doas realpath $1)"