From b38ea60f00786ca8c491561a9f27872ad00eaccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 2 Nov 2015 03:10:22 +0100 Subject: [PATCH] backup: improve exit code reporting Return some meaningful error code. Unfortunately the more meaningful option (retrieving process exit code) can lead to false errors (described in comment), but at least report exit code of tar2qfile. --- qubes-rpc/qubes.Restore | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qubes-rpc/qubes.Restore b/qubes-rpc/qubes.Restore index ab1f251..5db4fa8 100644 --- a/qubes-rpc/qubes.Restore +++ b/qubes-rpc/qubes.Restore @@ -20,9 +20,14 @@ else eval "set -- $args" # Use named pipe to pass original stdin to tar2file $@ > $tmpdir/backup-data < /dev/null & - retcode=$? /usr/lib/qubes/tar2qfile $tmpdir/backup-data $paths - wait + # Restoration may be terminated earlier because of selected files. This + # will be seen as EPIPE to the retrieving process, which may cause retcode + # other than 0 in some cases - which would be incorrectly treated as backup + # restore error. So instead of that, use tar2qfile exit code (and have dom0 + # detect if anything wrong with actual data) + retcode=$? + wait -n rm $tmpdir/backup-data rmdir $tmpdir exit $retcode