diff --git a/hgeditor b/hgeditor --- a/hgeditor +++ b/hgeditor @@ -27,10 +27,10 @@ cleanup_exit() { trap "cleanup_exit" 0 # normal exit trap "exit 255" HUP INT QUIT ABRT TERM -HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$RANDOM.$RANDOM.$$" -(umask 077 && mkdir "$HGTMP") || { - echo "Could not create temporary directory! Exiting." 1>&2 - exit 1 +HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX) +[ x$HGTMP != x -a -d $HGTMP ] || { + echo "Could not create temporary directory! Exiting." 1>&2 + exit 1 } (