make-fs: respect libguestfs' temporary dir

Do not hardcode /tmp.

(cherry picked from commit 2fe93bda9f8744553da19882043f11da5348dc35)
make-fs: do not leak the fd from mkstemp

(cherry picked from commit 8ea6b3e03c8cccdd18a7910e9e5da75ee1e27807)
launch: direct: check for null paths in make_uri

Some protocols may pass a null path to make_uri, so make sure to handle
that gracefully.

(cherry picked from commit 043cf4fbe30894af481c242095ed4cd436e136ea)
Revert "launch: Close file descriptors after fork (RHBZ#1123007)."

This attempted fix for RHBZ#1123007 causes the qemu command line to be
lost when verbose mode is enabled.  Since this is essential for
debugging many problems, I am reverting the patch.

This reverts commit 115fcc34325f965ac3723683e4462fc667dcd254.

(cherry picked from commit 286f116691c8aad4ac8bf0d044e9f6ca8d5b3356)
launch: Close file descriptors after fork (RHBZ#1123007).

This refactors existing code to close file descriptors in the recovery
process, and also adds code to close file descriptors between the
fork() and exec() of QEMU or User-Mode Linux.

The reason is to avoid leaking main process file descriptors where the
main process (or other libraries in the main process) are not setting
O_CLOEXEC at all or not setting it atomically.  Python is a particular
culprit.

See also this OpenStack Nova bug report:
https://bugs.launchpad.net/nova/+bug/1313477

Thanks: Qin Zhao for identifying and characterizing the problem in Nova.

This is version 2 of this commit.  This commit is identical to the
reverted commit 115fcc34325f965ac3723683e4462fc667dcd254 except that
we don't close stderr.

(cherry picked from commit e1c508c29f929134bfcb0f83b402a02e8ff94caa)
Version 1.26.7.