commit:     e98a0b87dbe1a99a1a7ac2410737ed0858129ffe
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  6 15:21:00 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Dec  6 17:15:01 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e98a0b87

multilib-build.eclass: Add missing error checks

 eclass/multilib-build.eclass | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index dd03553..09d4d72 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -262,19 +262,22 @@ multilib_for_best_abi() {
 # runs (if any). Dies if header files differ.
 multilib_check_headers() {
        _multilib_header_cksum() {
+               set -o pipefail
+
                [[ -d ${ED}usr/include ]] && \
                find "${ED}"usr/include -type f \
                        -exec cksum {} + | sort -k2
        }
 
-       local cksum=$(_multilib_header_cksum)
+       local cksum cksum_prev
        local cksum_file=${T}/.multilib_header_cksum
+       cksum=$(_multilib_header_cksum) || die
 
        if [[ -f ${cksum_file} ]]; then
-               local cksum_prev=$(< "${cksum_file}")
+               cksum_prev=$(< "${cksum_file}") || die
 
                if [[ ${cksum} != ${cksum_prev} ]]; then
-                       echo "${cksum}" > "${cksum_file}.new"
+                       echo "${cksum}" > "${cksum_file}.new" || die
 
                        eerror "Header files have changed between ABIs."
 
@@ -288,7 +291,7 @@ multilib_check_headers() {
                        die "Header checksum mismatch, aborting."
                fi
        else
-               echo "${cksum}" > "${cksum_file}"
+               echo "${cksum}" > "${cksum_file}" || die
        fi
 }
 
@@ -409,9 +412,9 @@ multilib_prepare_wrappers() {
 
                if [[ -L ${root}/${f} ]]; then
                        # rewrite the symlink target
-                       local target=$(readlink "${root}/${f}")
-                       local target_dir
-                       local target_fn=${target##*/}
+                       local target
+                       target=$(readlink "${root}/${f}") || die
+                       local target_dir target_fn=${target##*/}
 
                        [[ ${target} == */* ]] && target_dir=${target%/*}
 
@@ -453,7 +456,7 @@ multilib_prepare_wrappers() {
                                        if [[ ! -f 
${ED}/tmp/multilib-include${f} ]]; then
                                                dodir 
"/tmp/multilib-include${dir}"
                                                # a generic template
-                                               cat > "${wrapper}" <<_EOF_
+                                               cat > "${wrapper}" <<_EOF_ || 
die
 /* This file is auto-generated by multilib-build.eclass
  * as a multilib-friendly wrapper. For the original content,
  * please see the files that are #included below.

Reply via email to