Skip to content
Snippets Groups Projects
  • Eric Blake's avatar
    474a6e64
    tools: Fix use of fcntl(F_SETFD) during socket activation · 474a6e64
    Eric Blake authored
    
    Blindly setting FD_CLOEXEC without a read-modify-write will
    inadvertently clear any other intentionally-set bits, such as a
    proposed new bit for designating a fd that must behave in 32-bit mode.
    However, we cannot use our wrapper qemu_set_cloexec(), because that
    wrapper intentionally abort()s on failure, whereas the probe here
    intentionally tolerates failure to deal with incorrect socket
    activation gracefully.  Instead, fix the code to do the proper
    read-modify-write.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20200420175309.75894-3-eblake@redhat.com>
    Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    474a6e64
    History
    tools: Fix use of fcntl(F_SETFD) during socket activation
    Eric Blake authored
    
    Blindly setting FD_CLOEXEC without a read-modify-write will
    inadvertently clear any other intentionally-set bits, such as a
    proposed new bit for designating a fd that must behave in 32-bit mode.
    However, we cannot use our wrapper qemu_set_cloexec(), because that
    wrapper intentionally abort()s on failure, whereas the probe here
    intentionally tolerates failure to deal with incorrect socket
    activation gracefully.  Instead, fix the code to do the proper
    read-modify-write.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20200420175309.75894-3-eblake@redhat.com>
    Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>