Skip to content
  • Wolfgang Bumiller's avatar
    Close file descirptor before fork · 20127e73
    Wolfgang Bumiller authored and Allan McRae's avatar Allan McRae committed
    
    
    FreeBSD chroot(2) fails with EPERM when a directory file descriptor is open
    with either `kern.chroot_allow_open_directories` being 0, or when the process
    already is inside a chroot.  This is exposed in alpm_run_chroot that uses
    opendir() to open a file descriptor to the current directory before doing
    the forking and chrooting.  Since the file descriptor is not used in the
    forked process, we close it.
    
    Fixes FS#36161.
    
    Signed-off-by: default avatarAllan McRae <allan@archlinux.org>
    20127e73