diff options
author | Peter Osterlund <petero2@telia.com> | 2003-05-02 13:07:46 +0200 |
---|---|---|
committer | Peter Osterlund <petero2@telia.com> | 2006-04-09 04:00:54 +0200 |
commit | 92b799709aa862d06f7b6c9ad9e3a36f88943078 (patch) | |
tree | 4f85ea74086cf0ef96342a96f614a2d2328999f5 /synclient.c | |
parent | 87f83e25a119c53dd702a636a62a1e771d09766b (diff) |
Remove shared memory segment when the X server terminates.
Made synclient behave better when the memory segment is not accessible
or has the wrong size.
Diffstat (limited to 'synclient.c')
-rw-r--r-- | synclient.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/synclient.c b/synclient.c index 327b957..e12a5ce 100644 --- a/synclient.c +++ b/synclient.c @@ -26,10 +26,20 @@ int main() int shmid; SynapticsSHM old; - if((shmid = shmget(SHM_SYNAPTICS, 0, 0)) == -1) - printf("shmget Fehler\n"); - if((synshm = (SynapticsSHM*) shmat(shmid, NULL, 0)) == NULL) - printf("shmat Fehler\n"); + if((shmid = shmget(SHM_SYNAPTICS, sizeof(SynapticsSHM), 0)) == -1) { + if ((shmid = shmget(SHM_SYNAPTICS, 0, 0)) == -1) { + fprintf(stderr, "Can't access shared memory area. SHMConfig disabled?\n"); + exit(1); + } else { + fprintf(stderr, "Incorrect size of shared memory area. " + "Incompatible driver version?\n"); + exit(1); + } + } + if((synshm = (SynapticsSHM*) shmat(shmid, NULL, 0)) == NULL) { + perror("shmat"); + exit(1); + } while(1) { SynapticsSHM cur = *synshm; |