Skip to content

Commit

Permalink
shmoverride: don't override shm.id file
Browse files Browse the repository at this point in the history
When starting a second Xorg instance, don't override shm.id from the
first one. This can happen when the user tries to generate xorg.conf (X
-configure), or accidentally clicks "switch user".
  • Loading branch information
marmarek committed Oct 17, 2013
1 parent e38eb6c commit 0ac0c7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions shmoverride/shmoverride.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ int __attribute__ ((constructor)) initfunc()
perror("shmoverride xc_interface_open");
return 0; //allow it to run when not under Xen
}
idfd = open(SHMID_FILENAME, O_WRONLY | O_CREAT, 0600);
idfd = open(SHMID_FILENAME, O_WRONLY | O_CREAT | O_EXCL, 0600);
if (idfd < 0) {
perror("shmoverride creating " SHMID_FILENAME);
exit(1);
xc_interface_close(xc_hnd);
return 0;
}
local_shmid =
shmget(IPC_PRIVATE, SHM_CMD_NUM_PAGES * 4096,
Expand Down

0 comments on commit 0ac0c7f

Please sign in to comment.