!13 【Mainline】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:47:31 +00:00 committed by Gitee
commit f6bcaf96fa
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,7 +1,7 @@
Summary: A system tool for maintaining the /etc/rc*.d hierarchy
Name: chkconfig
Version: 1.20
Release: 1
Release: 2
License: GPLv2
URL: https://github.com/fedora-sysv/chkconfig
Source: https://github.com/fedora-sysv/chkconfig/archive/refs/tags/%{version}.tar.gz
@ -11,6 +11,8 @@ Provides: ntsysv = %{version}-%{release}
Obsoletes: ntsysv < %{version}-%{release}
Provides: /sbin/chkconfig
Patch0: fix-coredump-while-parseServiceInfo-return-1.patch
%description
Chkconfig is a basic system utility. It updates and queries runlevel
information for system services. Chkconfig manipulates the numerous
@ -55,6 +57,9 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d
%{_mandir}/man8/*
%changelog
* Sat Aug 27 2022 yixiangzhike <yixiangzhike007@163.com> - 1.20-2
- fix coredump while parseServiceInfo return non-zero
* Thu Dec 30 2021 wangchen <wangchen137@huawei.com> - 1.20-1
- Update to 1.20

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