src/video/x11/SDL_x11touch.c
changeset 5967 ae97a61f002f
parent 5966 2edecf22a2e7
child 5968 b229328c7ad4
--- a/src/video/x11/SDL_x11touch.c	Tue Sep 27 23:14:16 2011 -0400
+++ b/src/video/x11/SDL_x11touch.c	Tue Sep 27 23:15:01 2011 -0400
@@ -51,6 +51,10 @@
 
         sprintf(tstr,"/dev/input/event%i",event);
 
+        int tsfd = open( tstr, O_RDONLY | O_NONBLOCK );
+        if ( tsfd == -1 )
+            continue;   /* Maybe not enough permissions ? */
+
         SDL_Touch touch;
         touch.pressure_max = 0;
         touch.pressure_min = 0;
@@ -66,8 +70,7 @@
         data->up = SDL_FALSE;
         data->down = SDL_FALSE;
 
-        data->eventStream = open(tstr, 
-                    O_RDONLY | O_NONBLOCK);
+        data->eventStream = tsfd;
         ioctl (data->eventStream, EVIOCGNAME (sizeof (tstr)), tstr);
 
         int abs[5];