Set the flag O_CLOEXEC on all file handles so they don't interferes with the execution of scripts. See #100

This commit is contained in:
Micke Prag 2012-12-04 12:20:19 +01:00
parent 3441b9cc45
commit 2cb1a2ac97
3 changed files with 22 additions and 10 deletions

View file

@ -57,7 +57,7 @@ void Socket::connect(const std::wstring &server) {
struct sockaddr_un remote;
socklen_t len;
if ((d->socket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
if ((d->socket = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) == -1) {
return;
}
std::string name = "/tmp/" + std::string(server.begin(), server.end());