When probing machine types if the QEMU binary does not exist
we get a hard to diagnose error, due to the execve() in the
child failing
error: internal error Child process exited with status 1.
Add an explicit check so that we get
error: Cannot find QEMU binary /usr/libexec/qem3u-kvm: No such file or directory
* src/qemu/qemu_capabilities.c: Check for QEMU binary
int ret = -1;
virCommandPtr cmd;
+ /* Make sure the binary we are about to try exec'ing exists.
+ * Technically we could catch the exec() failure, but that's
+ * in a sub-process so it's hard to feed back a useful error.
+ */
+ if (access(binary, X_OK) < 0) {
+ virReportSystemError(errno, _("Cannot find QEMU binary %s"), binary);
+ return -1;
+ }
+
cmd = virCommandNewArgList(binary, "-M", "?", NULL);
virCommandAddEnvPassCommon(cmd);
virCommandSetOutputBuffer(cmd, &output);