From: Zac Medico Date: Mon, 9 Sep 2013 17:42:54 +0000 (-0700) Subject: doexe/newins: mktemp for bug #484332 X-Git-Tag: v2.2.2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=00b56f2ddc85542a277e83513bc9b09f63fca551;p=portage.git doexe/newins: mktemp for bug #484332 --- diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe index aa050e9ed..c34fcae74 100755 --- a/bin/ebuild-helpers/doexe +++ b/bin/ebuild-helpers/doexe @@ -17,8 +17,7 @@ if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then install -d "${ED}${_E_EXEDESTTREE_}" fi -TMP=$T/.doexe_tmp -mkdir "$TMP" +TMP=$(mktemp -d "${T}/.doexe_tmp_XXXXXX") ret=0 diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins index 3538f7060..03359851a 100755 --- a/bin/ebuild-helpers/newins +++ b/bin/ebuild-helpers/newins @@ -19,14 +19,15 @@ if ___eapi_newins_supports_reading_from_standard_input && [[ $1 == "-" ]]; then stdin=yes fi -rm -rf "${T}/$2" +TMP=$(mktemp -d "${T}/.newins_tmp_XXXXXX") +trap 'rm -rf "${TMP}"' EXIT if [[ ${stdin} ]] ; then if [[ -t 0 ]] ; then __helpers_die "!!! ${helper}: Input is from a terminal" exit 1 fi - cat > "${T}/$2" + cat > "${TMP}/$2" ret=$? else if [[ ! -e $1 ]] ; then @@ -41,7 +42,7 @@ else fi fi - cp ${cp_args} "$1" "${T}/$2" + cp ${cp_args} "$1" "${TMP}/$2" ret=$? fi @@ -50,8 +51,7 @@ if [[ ${ret} -ne 0 ]] ; then exit ${ret} fi -do${helper#new} "${T}/$2" +do${helper#new} "${TMP}/$2" ret=$? -rm -rf "${T}/${2}" [[ $ret -ne 0 ]] && __helpers_die "${helper} failed" exit $ret