From 876c75f1fabe77b2b190d4c62305428b8099b689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 14 Oct 2013 13:57:44 -0700 Subject: [PATCH] launcher: Fix reverted sense of drm_check_master() wrapper Also rename to drm_is_master() to make it clearer what we're checking. https://bugs.freedesktop.org/show_bug.cgi?id=70459 --- src/launcher-util.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/launcher-util.c b/src/launcher-util.c index 35a5698e..ea208951 100644 --- a/src/launcher-util.c +++ b/src/launcher-util.c @@ -81,18 +81,18 @@ drm_set_master(int drm_fd) return -EBADF; } static int -drm_check_master(int drm_fd) +drm_is_master(int drm_fd) { drm_magic_t magic; if (drm_fd != -1) - return drmGetMagic(drm_fd, &magic) != 0 || - drmAuthMagic(drm_fd, magic) != 0; + return drmGetMagic(drm_fd, &magic) == 0 && + drmAuthMagic(drm_fd, magic) == 0; return 0; } #else static int drm_drop_master(int drm_fd) {return 0;} static int drm_set_master(int drm_fd) {return 0;} -static int drm_check_master(int drm_fd) {return 1;} +static int drm_is_master(int drm_fd) {return 1;} #endif int @@ -121,7 +121,7 @@ weston_launcher_open(struct weston_launcher *launcher, if (major(s.st_rdev) == DRM_MAJOR) { launcher->drm_fd = fd; - if (!drm_check_master(fd)) { + if (!drm_is_master(fd)) { weston_log("drm fd not master\n"); close(fd); return -1;