xf86drm: test for render nodes before primary nodes

Unlike Linux the OpenBSD primary "drm" device name is substring of the
"drmR" render node device name and strncmp() tests resulted in render
nodes being flagged as primary nodes.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
main
Jonathan Gray 2019-05-13 02:50:49 +10:00 committed by Eric Engestrom
parent dcc586c66c
commit 13e2c35603
1 changed files with 4 additions and 4 deletions

View File

@ -3141,10 +3141,6 @@ drm_public int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b)
static int drmGetNodeType(const char *name)
{
if (strncmp(name, DRM_PRIMARY_MINOR_NAME,
sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0)
return DRM_NODE_PRIMARY;
if (strncmp(name, DRM_CONTROL_MINOR_NAME,
sizeof(DRM_CONTROL_MINOR_NAME ) - 1) == 0)
return DRM_NODE_CONTROL;
@ -3153,6 +3149,10 @@ static int drmGetNodeType(const char *name)
sizeof(DRM_RENDER_MINOR_NAME) - 1) == 0)
return DRM_NODE_RENDER;
if (strncmp(name, DRM_PRIMARY_MINOR_NAME,
sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0)
return DRM_NODE_PRIMARY;
return -EINVAL;
}