Skip to content

kdesud: close all file descriptors > 3 on exec()

Ahmad Samir requested to merge work/ahmad/fds into master

kdesud calls fork() then terminates the calling/parent process (by calling _exit(0) when the pid returned by fork() != 0).

  • Set the socket fd to 3, and then explicitly close all file descriptors higher than 3 right before calling fork().

  • Set O_CLOEXEC flag for the fd's used by pipe()

  • Set SOCK_CLOEXEC flag for the socket

Thanks for Fabian Vogt for helping me / explainging through all that. :)

Edited by Fabian Vogt

Merge request reports