Do not exit when zlog init failed
Signed-off-by: wangxiaoqing <wangxiaoqing@kylinsec.com.cn>
This commit is contained in:
parent
8555cc186f
commit
bfa15c9c0b
@ -1,92 +0,0 @@
|
|||||||
From 98f402e67e9a4a78e6461ecbddf3ab7c4ba05419 Mon Sep 17 00:00:00 2001
|
|
||||||
From: wangxiaoqing <wangxiaoqing@kylinos.com.cn>
|
|
||||||
Date: Tue, 25 Jan 2022 17:16:12 +0800
|
|
||||||
Subject: [PATCH] fix(kiran-biometrics): Add the enable zlog ex macro for zlog
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
- 添加ENABLE_ZLOG_EX宏来兼容不同版本的zlog
|
|
||||||
|
|
||||||
Signed-off-by: wangxiaoqing <wangxiaoqing@kylinos.com.cn>
|
|
||||||
---
|
|
||||||
src/CMakeLists.txt | 13 ++++++++++++-
|
|
||||||
src/kiran-biometrics.c | 4 ++++
|
|
||||||
src/main.c | 11 +++++++++++
|
|
||||||
3 files changed, 27 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
||||||
index a1891ca..c0ab353 100644
|
|
||||||
--- a/src/CMakeLists.txt
|
|
||||||
+++ b/src/CMakeLists.txt
|
|
||||||
@@ -9,7 +9,18 @@ if (DEFINED HAVE_KIRAN_FACE)
|
|
||||||
pkg_check_modules (ZMQ REQUIRED libzmq)
|
|
||||||
pkg_check_modules (GLIB_JSON REQUIRED json-glib-1.0)
|
|
||||||
endif()
|
|
||||||
-pkg_check_modules (ZLOG REQUIRED zlog)
|
|
||||||
+
|
|
||||||
+if (ENABLE_ZLOG_EX)
|
|
||||||
+ pkg_search_module(ZLOG REQUIRED zlog)
|
|
||||||
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_ZLOG_EX")
|
|
||||||
+else()
|
|
||||||
+ find_library(ZLOG_LIBRARY zlog)
|
|
||||||
+ set (ZLOG_INCLUDE_DIRS "")
|
|
||||||
+ set (ZLOG_LIBRARIES "${ZLOG_LIBRARY}")
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
+message("found zlog dirs: ${ZLOG_INCLUDE_DIRS}")
|
|
||||||
+message("found zlog libs: ${ZLOG_LIBRARIES}")
|
|
||||||
|
|
||||||
configure_file(${SRC_DIR}/config.h.in config.h)
|
|
||||||
configure_file(${SRC_DIR}/kiran-biometrics-i.h.in kiran-biometrics-i.h)
|
|
||||||
diff --git a/src/kiran-biometrics.c b/src/kiran-biometrics.c
|
|
||||||
index 538cb41..68e1cd6 100644
|
|
||||||
--- a/src/kiran-biometrics.c
|
|
||||||
+++ b/src/kiran-biometrics.c
|
|
||||||
@@ -21,7 +21,11 @@
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
+#ifdef ENABLE_ZLOG_EX
|
|
||||||
#include <zlog_ex.h>
|
|
||||||
+#else
|
|
||||||
+#include <zlog.h>
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#include "kiran-biometrics.h"
|
|
||||||
#include "kiran-fprint-manager.h"
|
|
||||||
diff --git a/src/main.c b/src/main.c
|
|
||||||
index 536e32c..547ff54 100644
|
|
||||||
--- a/src/main.c
|
|
||||||
+++ b/src/main.c
|
|
||||||
@@ -21,7 +21,11 @@
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <gmodule.h>
|
|
||||||
#include <locale.h>
|
|
||||||
+#ifdef ENABLE_ZLOG_EX
|
|
||||||
#include <zlog_ex.h>
|
|
||||||
+#else
|
|
||||||
+#include <zlog.h>
|
|
||||||
+#endif
|
|
||||||
#include "kiran-biometrics.h"
|
|
||||||
|
|
||||||
|
|
||||||
@@ -34,8 +38,15 @@ int main (int argc, char **argv)
|
|
||||||
DBusGProxy *driver_proxy;
|
|
||||||
guint request_name_ret;
|
|
||||||
|
|
||||||
+#ifdef ENABLE_ZLOG_EX
|
|
||||||
if (dzlog_init_ex (NULL, "kylinsec-system", "kiran-biometrics", "kiran_biometrics_manager") < 0)
|
|
||||||
+#else
|
|
||||||
+ if (dzlog_init("/etc/zlog.conf", "kylinsec-system") < 0)
|
|
||||||
+#endif
|
|
||||||
+ {
|
|
||||||
+ g_error ("zlog init failed!");
|
|
||||||
return -1;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
|
||||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
Binary file not shown.
BIN
kiran-biometrics-0.0.3.tar.gz
Normal file
BIN
kiran-biometrics-0.0.3.tar.gz
Normal file
Binary file not shown.
@ -1,16 +1,14 @@
|
|||||||
%global on_openeuler 1
|
%global on_openeuler 1
|
||||||
|
|
||||||
Name: kiran-biometrics
|
Name: kiran-biometrics
|
||||||
Version: 0.0.2
|
Version: 0.0.3
|
||||||
Release: 2.kb4
|
Release: 1
|
||||||
Summary: Kiran Desktop kiran-biometrics
|
Summary: Kiran Desktop kiran-biometrics
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
URL: http://www.kylinsec.com.cn
|
URL: http://www.kylinsec.com.cn
|
||||||
|
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Patch0: 0001-fix-kiran-biometrics-Add-the-enable-zlog-ex-macro-fo-98f402e6.patch
|
|
||||||
|
|
||||||
BuildRequires: glib2-devel
|
BuildRequires: glib2-devel
|
||||||
BuildRequires: dbus-glib-devel
|
BuildRequires: dbus-glib-devel
|
||||||
%if 0%{?on_openeuler}
|
%if 0%{?on_openeuler}
|
||||||
@ -88,6 +86,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
|
|||||||
%{_includedir}/kiran-biometrics/kiran-biometrics-i.h
|
%{_includedir}/kiran-biometrics/kiran-biometrics-i.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Oct 27 2022 wangxiaoqing <wangxiaoqing@kylinsec.com.cn> - 0.0.3-1
|
||||||
|
- KYOS-B: Do not exit when zlog init failed.
|
||||||
|
|
||||||
* Wed Aug 10 2022 luoqing <luoqing@kylinsec.com.cn> - 0.0.2-2.kb4
|
* Wed Aug 10 2022 luoqing <luoqing@kylinsec.com.cn> - 0.0.2-2.kb4
|
||||||
- KYOS-F: Modify license and add yaml file.
|
- KYOS-F: Modify license and add yaml file.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user