Fix coredump while parseServiceInfo return non-zero

Signed-off-by: yixiangzhike <yixiangzhike007@163.com>
This commit is contained in:
yixiangzhike 2022-08-27 10:11:34 +08:00
parent 4a98ce75a8
commit 517712290e
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 Summary: A system tool for maintaining the /etc/rc*.d hierarchy
Name: chkconfig Name: chkconfig
Version: 1.20 Version: 1.20
Release: 1 Release: 2
License: GPLv2 License: GPLv2
URL: https://github.com/fedora-sysv/chkconfig URL: https://github.com/fedora-sysv/chkconfig
Source: https://github.com/fedora-sysv/chkconfig/archive/refs/tags/%{version}.tar.gz 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} Obsoletes: ntsysv < %{version}-%{release}
Provides: /sbin/chkconfig Provides: /sbin/chkconfig
Patch0: fix-coredump-while-parseServiceInfo-return-1.patch
%description %description
Chkconfig is a basic system utility. It updates and queries runlevel Chkconfig is a basic system utility. It updates and queries runlevel
information for system services. Chkconfig manipulates the numerous information for system services. Chkconfig manipulates the numerous
@ -55,6 +57,9 @@ mkdir -p $RPM_BUILD_ROOT/etc/chkconfig.d
%{_mandir}/man8/* %{_mandir}/man8/*
%changelog %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 * Thu Dec 30 2021 wangchen <wangchen137@huawei.com> - 1.20-1
- Update to 1.20 - 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