!15 【openEuler-20.03-LTS-SP3】Fix coredump while parseServiceInfo return non-zero

From: @yixiangzhike 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
This commit is contained in:
openeuler-ci-bot 2022-08-27 02:46:26 +00:00 committed by Gitee
commit 36d30def25
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: chkconfig
Version: 1.14
Release: 1
Release: 2
Summary: chkconfig updates and queries runlevel information for system services
License: GPLv2
URL: https://github.com/fedora-sysv/chkconfig
@ -11,6 +11,8 @@ Conflicts: initscripts <= 5.30-1
Provides: ntsysv = %{version}-%{release}
Obsoletes: ntsysv < %{version}-%{release}
Patch0: fix-coredump-while-parseServiceInfo-return-1.patch
%description
chkconfig provides a simple command-line tool for maintaining
the /etc/rc[0-6].d directory hierarchy by relieving system
@ -57,6 +59,9 @@ mkdir -p %{buildroot}%{_sysconfdir}/chkconfig.d
%{_mandir}/man8/*
%changelog
* Sat Aug 27 2022 yixiangzhike <yixiangzhike007@163.com> - 1.14-2
- fix coredump while parseServiceInfo return non-zero
* Fri Jul 31 2020 wangchen <wangchen137@huawei.com> - 1.14-1
- Update to 1.14

View File

@ -0,0 +1,25 @@
From 05f7ea8fa198a6b98dd98cb1a8b1774da701e917 Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Fri, 12 Aug 2022 10:01:32 +0800
Subject: [PATCH] fix coredump while parseServiceInfo return 1
---
leveldb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/leveldb.c b/leveldb.c
index 7b8c1bd..8a7a81d 100644
--- a/leveldb.c
+++ b/leveldb.c
@@ -377,7 +377,7 @@ int readServiceInfo(char *name, int type, struct service *service,
asprintf(&filename, RUNLEVELS "/chkconfig.d/%s", name);
if ((fd = open(filename, O_RDONLY)) >= 0) {
parseret = parseServiceInfo(fd, name, &serv_overrides, honorHide, 1);
- if (parseret >= 0) {
+ if (parseret == 0) {
if (serv_overrides.name)
serv.name = serv_overrides.name;
if (serv_overrides.levels != -1)
--
2.27.0