diff options
author | Eric Anholt <anholt@freebsd.org> | 2002-08-22 02:49:58 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2002-08-22 02:49:58 +0000 |
commit | a61589717f056786e2f25e9cdb7027b259538418 (patch) | |
tree | 86f9d5d68f4cd804c651b2a3096d9755d1d6ebd9 | |
parent | 46f3c135024a0992c2e42a8a36f895f2e8945930 (diff) |
Bring over xf86drm.c 1.37 so r200 linux binaries will be FreeBSDr200-0-1-20020826-freeze
compatible.
-rw-r--r-- | libdrm/xf86drm.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index b5375ee5..d2ce5e1e 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -229,7 +229,7 @@ static int drmOpenDevice(long dev, int minor) sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor); drmMsg("drmOpenDevice: node name is %s\n", buf); - if (stat(buf, &st) || st.st_rdev != dev) { + if (stat(buf, &st)) { if (!isroot) return DRM_ERR_NOT_ROOT; remove(buf); mknod(buf, S_IFCHR | devmode, dev); @@ -243,6 +243,16 @@ static int drmOpenDevice(long dev, int minor) drmMsg("drmOpenDevice: open result is %d, (%s)\n", fd, fd < 0 ? strerror(errno) : "OK"); if (fd >= 0) return fd; + + if (st.st_rdev != dev) { + if (!isroot) return DRM_ERR_NOT_ROOT; + remove(buf); + mknod(buf, S_IFCHR | devmode, dev); + } + fd = open(buf, O_RDWR, 0); + drmMsg("drmOpenDevice: open result is %d, (%s)\n", + fd, fd < 0 ? strerror(errno) : "OK"); + drmMsg("drmOpenDevice: Open failed\n"); remove(buf); return -errno; |