--- qemu-start/trunk/qemu-start.c 2006/02/11 16:27:16 291 +++ qemu-start/trunk/qemu-start.c 2006/02/11 16:32:44 292 @@ -45,6 +45,7 @@ char *ptr; char *command; char *display; + char *xauthfile; /* Check parameters */ if (argc < 4) { @@ -89,9 +90,12 @@ /* Fix X-display */ userdata = getpwuid(getuid()); + if (! (xauthfile = getenv("XAUTHORITY"))) + asprintf(&xauthfile,"~%s/.Xauthority",userdata->pw_name); setuid(0); setgid(0); - asprintf(&command,"xauth -f ~%s/.Xauthority extract - $(echo $DISPLAY|sed \"s,^localhost,$(hostname)/unix,\") | xauth -f ~%s/.Xauthority merge -; chown %s: ~%s/.Xauthority",userdata->pw_name,USER,USER,USER); + asprintf(&command,"xauth -f %s extract - $(echo $DISPLAY|sed \"s,^localhost,$(hostname)/unix,\") | xauth -f ~%s/.Xauthority merge -; chown %s: ~%s/.Xauthority",xauthfile,USER,USER,USER); +fprintf(stderr,"%s\n",command); system(command); /* Set correct userid. */