Un-break the check for failed authentication
authorThomas White <taw@bitwiz.org.uk>
Thu, 30 Apr 2009 22:23:27 +0000 (23:23 +0100)
committerThomas White <taw@bitwiz.org.uk>
Thu, 30 Apr 2009 22:23:27 +0000 (23:23 +0100)
gdri-cmdq-submission.c

index eafe65f..2d7fdaf 100644 (file)
@@ -61,7 +61,7 @@ static int do_drm_authentication(Display *dpy)
        /* Get device name */
        if ( !DRI2Connect(dpy, root, &driver, &device) ) {
                fprintf(stderr, "DRI2Connect failed\n");
-               return 1;
+               return -1;
        }
 
        /* Open DRM device */
@@ -69,19 +69,19 @@ static int do_drm_authentication(Display *dpy)
        if ( fd < 0 ) {
                fprintf(stderr, "Couldn't open '%s': %s\n",
                        device, strerror(errno));
-               return 1;
+               return -1;
        }
 
        /* Get an authentication token */
        if ( drmGetMagic(fd, &magic) ) {
                fprintf(stderr, "drmGetMagic failed\n");
-               return 1;
+               return -1;
        }
 
        /* Authenticate */
        if ( DRI2Authenticate(dpy, root, magic) == False ) {
                fprintf(stderr, "DRI2Authenticate failed\n");
-               return 1;
+               return -1;
        }
 
        return fd;
@@ -106,6 +106,10 @@ int main()
        }
 
        fd = do_drm_authentication(dpy);
+       if ( fd < 0 ) {
+               fprintf(stderr, "Couldn't authenticate\n");
+               return 1;
+       }
 
        cmds = malloc(2*13*2);