From 80e5b6ac58c03f7fa9e52f551c6266c0b541455c Mon Sep 17 00:00:00 2001
From: Marek Vavrusa <marek@vavrusa.com>
Date: Tue, 9 Aug 2016 14:27:24 -0700
Subject: [PATCH] daemon/lua: support new libknot 2.3 soversion

---
 daemon/lua/kres.lua | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/daemon/lua/kres.lua b/daemon/lua/kres.lua
index 5c6fd505a..a314ee28e 100644
--- a/daemon/lua/kres.lua
+++ b/daemon/lua/kres.lua
@@ -11,7 +11,18 @@ local bit = require('bit')
 local bor = bit.bor
 local band = bit.band
 local C = ffi.C
-local knot = ffi.load(libpath('libknot', '2'))
+
+-- Load any of supported libknot SO versions
+local knot
+for ver = 2, 3 do
+	local ok, lib = pcall(ffi.load, libpath('libknot', tostring(ver)))
+	if ok then
+		knot = lib
+		break
+	end
+end
+assert(knot, 'support libknot not found')
+
 ffi.cdef[[
 
 /*
-- 
GitLab