summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2009-03-25 20:51:33 +0000
committerJakob Bornecrantz <[email protected]>2009-03-25 21:06:40 +0000
commit78abcb88fedd7177a5da93a987793d3a86a0ec57 (patch)
treeee33dcc519a0bfac225d715d84724bb6efa8206e /src/gallium/state_trackers
parentde89c022d5a2e63b52a9ae27ec70b9f5e203d3ed (diff)
st/egl: Fix warning
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index a22ef381b96..9667c7ee3d4 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -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);
}