Skip to content

Commit

Permalink
buffer: Remove use of major()/minor()
Browse files Browse the repository at this point in the history
These are in different headers on FreeBSD, so a more portable way of
checking is to compare dev_t directly against zero.
  • Loading branch information
any1 committed Sep 7, 2024
1 parent cb53a38 commit 5d67b9d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <gbm.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/sysmacros.h>
#include <xf86drm.h>

#ifdef HAVE_LINUX_DMA_HEAP
Expand Down Expand Up @@ -497,7 +496,7 @@ static int find_render_node(char *node, size_t maxlen) {
static void open_render_node(struct wv_buffer_pool* pool)
{
char path[256];
if (major(pool->config.node) != 0 || minor(pool->config.node) != 0) {
if (pool->config.node) {
if (render_node_from_dev_t(path, sizeof(path),
pool->config.node) < 0) {
nvnc_log(NVNC_LOG_ERROR, "Could not find render node from dev_t");
Expand Down Expand Up @@ -546,8 +545,7 @@ void wv_buffer_pool_reconfig(struct wv_buffer_pool* pool,
open_render_node(pool);
}

if (major(pool->config.node) == 0 && minor(pool->config.node) == 0 &&
!pool->gbm)
if (!pool->config.node && !pool->gbm)
open_render_node(pool);

assert(pool->gbm);
Expand Down

0 comments on commit 5d67b9d

Please sign in to comment.