summaryrefslogtreecommitdiffstats
path: root/x11vnc/user.c
diff options
context:
space:
mode:
authorrunge <runge>2007-05-04 04:06:00 +0000
committerrunge <runge>2007-05-04 04:06:00 +0000
commit6378acecb04b2824179fea0ab168cbfcb960e70d (patch)
tree231bf1d08220d57c2e49a94e7b0c4e81f6dcde83 /x11vnc/user.c
parent85303147a02cce513cb62fc25ab728238dec69b7 (diff)
downloadlibtdevnc-6378acecb04b2824179fea0ab168cbfcb960e70d.tar.gz
libtdevnc-6378acecb04b2824179fea0ab168cbfcb960e70d.zip
x11vnc: add WAITBG=1 env. var, add mwm to -create.
Diffstat (limited to 'x11vnc/user.c')
-rw-r--r--x11vnc/user.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/x11vnc/user.c b/x11vnc/user.c
index 6aa3834..25d818a 100644
--- a/x11vnc/user.c
+++ b/x11vnc/user.c
@@ -1434,6 +1434,38 @@ int wait_for_client(int *argc, char** argv, int http) {
avahi_advertise(name, this_host(), screen->port);
}
+ if (getenv("WAITBG")) {
+#if LIBVNCSERVER_HAVE_FORK && LIBVNCSERVER_HAVE_SETSID
+ int p, n;
+ if ((p = fork()) > 0) {
+ exit(0);
+ } else if (p == -1) {
+ rfbLogEnable(1);
+ fprintf(stderr, "could not fork\n");
+ perror("fork");
+ clean_up_exit(1);
+ }
+ if (setsid() == -1) {
+ rfbLogEnable(1);
+ fprintf(stderr, "setsid failed\n");
+ perror("setsid");
+ clean_up_exit(1);
+ }
+ /* adjust our stdio */
+ n = open("/dev/null", O_RDONLY);
+ dup2(n, 0);
+ dup2(n, 1);
+ if (! logfile) {
+ dup2(n, 2);
+ }
+ if (n > 2) {
+ close(n);
+ }
+#else
+ clean_up_exit(1);
+#endif
+ }
+
if (inetd && use_openssl) {
accept_openssl(OPENSSL_INETD, -1);
}
@@ -1630,6 +1662,8 @@ if (!keep_unixpw_opts) {
sprintf(xsess, "twm");
} else if (strstr(t, "fvwm")) {
sprintf(xsess, "fvwm");
+ } else if (strstr(t, "mwm")) {
+ sprintf(xsess, "mwm");
} else if (strstr(t, "failsafe")) {
sprintf(xsess, "failsafe");
}