• M
    lib: Avoid double close when passing FDs with virCommandPassFD() · 5cdd5d38
    Michal Privoznik 提交于
    If an FD is passed into a child using:
    
      virCommandPassFD(cmd, fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);
    
    then the parent should refrain from touching @fd thereafter. This
    is even documented in virCommandPassFD() comment. The reason is
    that either at virCommandRun()/virCommandRunAsync() or
    virCommandFree() time the @fd will be closed. Closing it earlier,
    e.g. right after virCommandPassFD() call might result in
    undesired results. Another thread might open a file and receive
    the same FD which is then unexpectedly closed by virCommandFree()
    or virCommandRun().
    Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
    Reviewed-by: NJán Tomko <jtomko@redhat.com>
    5cdd5d38
qemu_command.c 367.8 KB