Skip to content
  • Peter Maydell's avatar
    slirp: fork_exec(): create and connect child socket before fork() · 5c75f3ad
    Peter Maydell authored
    
    
    Currently fork_exec() fork()s, and then creates and connects the
    child socket which it uses for communication with the parent in
    the child process. This is awkward because the child has no
    mechanism to report failure back to the parent, which might end
    up blocked forever in accept(). The child code also has an issue
    pointed out by Coverity (CID 1005727), where if the qemu_socket()
    call fails it will pass -1 as a file descriptor to connect().
    
    Fix these issues by moving the creation of the child's end of
    the socket to before the fork(), where we are in a position to
    handle a possible failure.
    
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
    5c75f3ad