[Fakeroot-commits] fakeroot--main--0.0--patch-67 commit: Wrap close and dup2 to avoid closing TCP socket
Clint Adams
schizo@costa.debian.org
Fri, 20 May 2005 14:15:03 +0000
2005-05-20 Timo Savola <tsavola@movial.fi> patch-67
* communicate.c:
* communicate.h:
* libfakeroot.c:
* wrapfunc.inp:
Wrap close and dup2 to avoid closing TCP socket
close(2) doesn't allow closing of the communication socket used by the TCP
version. When dup2(2) is called with the communication socket as the
target file descriptor, it will first dup(2) the socket to a new number.
This makes the --fd-base option and the checking obsolete.
The comm_sd variable is exported for libfakeroot.c which is also
responsible for locking. comm_sd and the comm_sd-related functions are
not exported for faked.c because it doesn't use that functionality AND it
has its own comm_sd variable... (Declarations needed by the TCP version
of faked.c should be split away from communication.h in the future.)
The fork(2) wrapper is changed to preserve errno correctly, and it no
longer locks when closing the comm_sd of the child process. The socket is
now also set to close-on-exec.