weak-modules: compare_initramfs_modules: exit on pushd/popd failures

Coverity reports warning
`warning[SC2164]: Use 'popd ... || exit' or 'popd ... || return' in case popd fails.`

This cannot happen in case of weak-modules, but makes no harm.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
This commit is contained in:
Yauheni Kaliuta 2021-06-08 11:49:52 +03:00 committed by Yauheni Kaliuta
parent 50733019f1
commit 2679f21c98

View File

@ -179,24 +179,24 @@ compare_initramfs_modules() {
mkdir "$tmpdir/new_initramfs" mkdir "$tmpdir/new_initramfs"
decompress_initramfs "$old_initramfs" "$tmpdir/old_initramfs.img" decompress_initramfs "$old_initramfs" "$tmpdir/old_initramfs.img"
pushd "$tmpdir/old_initramfs" >/dev/null pushd "$tmpdir/old_initramfs" >/dev/null || exit
cpio -i < "$tmpdir/old_initramfs.img" 2>/dev/null cpio -i < "$tmpdir/old_initramfs.img" 2>/dev/null
rm "$tmpdir/old_initramfs.img" rm "$tmpdir/old_initramfs.img"
n=0; for i in `list_module_files|sort`; do n=0; for i in `list_module_files|sort`; do
old_initramfs_modules[n]="$i" old_initramfs_modules[n]="$i"
n=$((n+1)) n=$((n+1))
done done
popd >/dev/null popd >/dev/null || exit
decompress_initramfs "$new_initramfs" "$tmpdir/new_initramfs.img" decompress_initramfs "$new_initramfs" "$tmpdir/new_initramfs.img"
pushd "$tmpdir/new_initramfs" >/dev/null pushd "$tmpdir/new_initramfs" >/dev/null || exit
cpio -i < "$tmpdir/new_initramfs.img" 2>/dev/null cpio -i < "$tmpdir/new_initramfs.img" 2>/dev/null
rm "$tmpdir/new_initramfs.img" rm "$tmpdir/new_initramfs.img"
n=0; for i in `list_module_files|sort`; do n=0; for i in `list_module_files|sort`; do
new_initramfs_modules[n]="$i" new_initramfs_modules[n]="$i"
n=$((n+1)) n=$((n+1))
done done
popd >/dev/null popd >/dev/null || exit
# Compare the length and contents of the arrays # Compare the length and contents of the arrays
if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" -a \ if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" -a \