mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
When executing a command, we temporarily chroot, fork and exec the
command, then chroot back. We intentionally don't chdir in the parent
process so that we can 'jailbreak' the chroot later. However, this has
the effect that commands are executed with a current working directory
which is outside the current root. This unusual state can cause
errors in executed commands which don't anticipate it.
This change does a chdir("/") before executing and command. This
happens inside the fork, so the jailbreak isn't affected in the
parent.