diff options
author | Zac Medico <zmedico@gentoo.org> | 2013-09-09 10:42:54 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2013-09-09 10:42:54 -0700 |
commit | 00b56f2ddc85542a277e83513bc9b09f63fca551 (patch) | |
tree | b47c3880c799e991dc29e51c85864e7700d07717 | |
parent | doins: use mktemp for private files, bug #484332 (diff) | |
download | portage-00b56f2ddc85542a277e83513bc9b09f63fca551.tar.gz portage-00b56f2ddc85542a277e83513bc9b09f63fca551.tar.bz2 portage-00b56f2ddc85542a277e83513bc9b09f63fca551.zip |
doexe/newins: mktemp for bug #484332
-rwxr-xr-x | bin/ebuild-helpers/doexe | 3 | ||||
-rwxr-xr-x | bin/ebuild-helpers/newins | 10 |
2 files changed, 6 insertions, 7 deletions
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 |