From 5b198763c597459a27e7e88827dcc748b98b6670 Mon Sep 17 00:00:00 2001 From: runge Date: Sun, 10 Dec 2006 03:12:02 +0000 Subject: x11vnc: FINDCREATEDISPLAY support to create X session if one cannot be found. Fix bug in java viewer. --- x11vnc/cleanup.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'x11vnc/cleanup.c') diff --git a/x11vnc/cleanup.c b/x11vnc/cleanup.c index 16115cd..199220d 100644 --- a/x11vnc/cleanup.c +++ b/x11vnc/cleanup.c @@ -35,6 +35,7 @@ char *xerror_string(XErrorEvent *error); void initialize_crash_handler(void); void initialize_signals(void); void unset_signals(void); +void close_exec_fds(void); int known_sigpipe_mode(char *s); @@ -542,6 +543,18 @@ void unset_signals(void) { signal(SIGPIPE, SIG_DFL); } +void close_exec_fds(void) { + int fd; +#ifdef FD_CLOEXEC + for (fd = 3; fd < 64; fd++) { + int flags = fcntl(fd, F_GETFD); + if (flags != -1) { + flags |= FD_CLOEXEC; + fcntl(fd, F_SETFD, flags); + } + } +#endif +} int known_sigpipe_mode(char *s) { /* -- cgit v1.2.1