qfile-unpacker: Avoid data loss by checking for child errors

When qfile-unpacker's child encountered an error, it would display an
error message and exit(1), but the parent didn't inspect its status and
exited successfully.

That was unfortunate for qvm-move-to-vm: Even if the destination VM e.g.
didn't have enough free disk space, the RPC call would claim to succeed
anyway, so the file would be deleted from the source VM.
This commit is contained in:
Rusty Bird 2015-10-30 09:23:45 +00:00
parent ce443b2e18
commit 4027decbaa
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -90,5 +90,8 @@ int main(int argc __attribute((__unused__)), char ** argv __attribute__((__unuse
} }
if (umount2(".", MNT_DETACH) < 0) if (umount2(".", MNT_DETACH) < 0)
gui_fatal("Cannot umount incoming directory"); gui_fatal("Cannot umount incoming directory");
return ret; if (!WIFEXITED(ret)) {
gui_fatal("Child process exited abnormally");
}
return WEXITSTATUS(ret);
} }