dispvm: error out on saved-cows.tar creation error

If it fails - for example because of too restrictive volatile.img
permissions, subsequent DispVM will not be really disposable.
The original permissions issue should be fixed by previous commit, this
one makes sure that such errors will not be ignored.

Fixes QubesOS/qubes-issues#2200
This commit is contained in:
Marek Marczykowski-Górecki 2016-08-07 00:08:46 +02:00
parent 09b49feea6
commit d0ddb3d17c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -74,8 +74,13 @@ fstype=`df --output=fstype $VMDIR | tail -n 1`
if [ "$fstype" = "tmpfs" ]; then
# bsdtar doesn't work on tmpfs because FS_IOC_FIEMAP ioctl isn't supported
# there
tar -cSf saved-cows.tar volatile.img
tar -cSf saved-cows.tar volatile.img || exit 1
else
bsdtar -cSf saved-cows.tar volatile.img
errors=`bsdtar -cSf saved-cows.tar volatile.img 2>&1`
if [ -n "$errors" ]; then
echo "Failed to create saved-cows.tar: $errors" >&2
rm -f saved-cows.tar
exit 1
fi
fi
echo "DVM savefile created successfully."