From 8d21dcff7cef34c4f9a854deebdabb02503a3dae Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Sun, 15 Feb 2009 09:56:42 -0800 Subject: mkinitramfs: Do not pass exit code through on pipe failure Since "exit 2" has a special meaning, we must "exit 1" when the find/cpio/gzip pipe fails, otherwise "update-initramfs" will potentially ignore failures (it ignores return code "2" from mkinitramfs). Signed-off-by: Kees Cook --- mkinitramfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkinitramfs b/mkinitramfs index 2f5112c..d1d46b0 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -268,7 +268,7 @@ fi [ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" ( # work around lack of "set -o pipefail" for the following pipe: -# cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" +# cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" || exit 1 exec 3>&1 eval ` # http://cfaj.freeshell.org/shell/cus-faq-2.html @@ -284,7 +284,7 @@ eval ` if [ "$ec1" -ne 0 ]; then exit "$ec1"; fi if [ "$ec2" -ne 0 ]; then exit "$ec2"; fi if [ "$ec3" -ne 0 ]; then exit "$ec3"; fi -) || exit $? +) || exit 1 if [ -s "${__TMPCPIOGZ}" ]; then cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 -- cgit v1.2.3