summaryrefslogtreecommitdiffstats
path: root/x11vnc/xwrappers.c
diff options
context:
space:
mode:
Diffstat (limited to 'x11vnc/xwrappers.c')
-rw-r--r--x11vnc/xwrappers.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c
index 416b4ee..1ec1ff3 100644
--- a/x11vnc/xwrappers.c
+++ b/x11vnc/xwrappers.c
@@ -1055,8 +1055,15 @@ int xauth_raw(int on) {
}
return 1;
} else {
- if (old_xauthority) {
+ if (old_xauthority && strcmp(old_xauthority, "")) {
set_env("XAUTHORITY", old_xauthority);
+ } else {
+ char *xauth = getenv("XAUTHORITY");
+ if (xauth) {
+ *(xauth-2) = '_'; /* yow */
+ }
+ }
+ if (old_xauthority) {
free(old_xauthority);
old_xauthority = NULL;
}