wayland: Prevent leaking --wayland-fd and --xwayland-fd to child processes

fcntl() expects FD_CLOEXEC instead of conventional O_CLOEXEC.
This commit is contained in:
Vlad Zahorodnii 2023-03-08 18:05:54 +02:00
parent 0e3bf29e3b
commit 1e0d5bba71

View file

@ -505,7 +505,7 @@ int main(int argc, char *argv[])
int fd = parser.value(waylandSocketFdOption).toInt(&ok);
if (ok) {
// make sure we don't leak this FD to children
fcntl(fd, F_SETFD, O_CLOEXEC);
fcntl(fd, F_SETFD, FD_CLOEXEC);
server->display()->addSocketFileDescriptor(fd, socketName);
} else {
std::cerr << "FATAL ERROR: could not parse socket FD" << std::endl;
@ -589,7 +589,7 @@ int main(int argc, char *argv[])
int fd = fdString.toInt(&ok);
if (ok) {
// make sure we don't leak this FD to children
fcntl(fd, F_SETFD, O_CLOEXEC);
fcntl(fd, F_SETFD, FD_CLOEXEC);
a.addXwaylandSocketFileDescriptor(fd);
}
}