st/egl: Fix warning
authorJakob Bornecrantz <wallbraker@gmail.com>
Wed, 25 Mar 2009 20:51:33 +0000 (20:51 +0000)
committerJakob Bornecrantz <jakob@vmware.com>
Wed, 25 Mar 2009 21:06:40 +0000 (21:06 +0000)
src/gallium/state_trackers/egl/egl_tracker.c

index a22ef381b966a3a6ea7084d897deed7857b05b83..9667c7ee3d46a88dabe6303b0801b2de8e2cc957 100644 (file)
@@ -66,10 +66,13 @@ drm_get_device_id(struct drm_device *device)
 {
        char path[512];
        FILE *file;
+       char *ret;
 
        /* TODO get the real minor */
        int minor = 0;
 
+       device->deviceID = 0;
+
        snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", minor);
        file = fopen(path, "r");
        if (!file) {
@@ -77,7 +80,10 @@ drm_get_device_id(struct drm_device *device)
                return;
        }
 
-       fgets(path, sizeof( path ), file);
+       ret = fgets(path, sizeof( path ), file);
+       if (!ret)
+               return;
+
        sscanf(path, "%x", &device->deviceID);
        fclose(file);
 }