/[public]/qemu-start/trunk/qemu-start.c
ViewVC logotype

Diff of /qemu-start/trunk/qemu-start.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 290 Revision 292
43 char *newargs[argc + 2]; 43 char *newargs[argc + 2];
44 int i,fd,vlan,tapnr; 44 int i,fd,vlan,tapnr;
45 char *ptr; 45 char *ptr;
46 char *command; 46 char *command;
47 char *display; 47 char *display;
48 char *xauthfile;
48 49
49 /* Check parameters */ 50 /* Check parameters */
50 if (argc < 4) { 51 if (argc < 4) {
51 fprintf(stderr, "Usage: qemu-start TAPDEVNR VLAN SYSTEM <qemu options>...\n"); 52 fprintf(stderr, "Usage: qemu-start TAPDEVNR VLAN SYSTEM <qemu options>...\n");
52 fprintf(stderr, " A device tapTAPDEVNR must have been configured.\n"); 53 fprintf(stderr, " A device tapTAPDEVNR must have been configured.\n");
87 exit(1); 88 exit(1);
88 } 89 }
89 90
90 /* Fix X-display */ 91 /* Fix X-display */
91 userdata = getpwuid(getuid()); 92 userdata = getpwuid(getuid());
93 if (! (xauthfile = getenv("XAUTHORITY")))
94 asprintf(&xauthfile,"~%s/.Xauthority",userdata->pw_name);
92 setuid(0); 95 setuid(0);
93 setgid(0); 96 setgid(0);
94 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); 97 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);
98fprintf(stderr,"%s\n",command);
95 system(command); 99 system(command);
96 100
97 /* Set correct userid. */ 101 /* Set correct userid. */
98 userdata = getpwnam(USER); 102 userdata = getpwnam(USER);
99 if (!userdata) { 103 if (!userdata) {

Legend:
Removed from v.290  
changed lines
  Added in v.292

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26