!16 修复gdbmtool 使用import参数时错误

From: @yangchen_guang
Reviewed-by: @liuzhiqiang26
Signed-off-by: @liuzhiqiang26
This commit is contained in:
openeuler-ci-bot 2021-11-29 06:16:11 +00:00 committed by Gitee
commit 4ee8c7ed04
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 4f456e7c4b9e3727a83bc3d30ac929402f7ef81a Mon Sep 17 00:00:00 2001
From: yangchenguang <yangchenguang@uniontech.com>
Date: Fri, 19 Nov 2021 10:44:24 +0800
Subject: [PATCH] Fix gdbmtool import command
* src/gdbmtool.c (import_handler): Fix option addressing (see
https://puszcza.gnu.org.ua/bugs/?535).
Fix freeing of the uninitialized variable.
---
src/gdbmtool.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index bbadbae..03ba482 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -1003,7 +1003,7 @@ import_handler (struct handler_param *param)
int i;
int rc;
- for (i = 0; i < param->argc; i++)
+ for (i = 1; i < param->argc; i++)
{
if (strcmp (PARAM_STRING (param, i), "replace") == 0)
flag = GDBM_REPLACE;
@@ -1054,7 +1054,6 @@ import_handler (struct handler_param *param)
return;
}
- free (file_name);
if (gdbm_setopt (gdbm_file, GDBM_GETDBNAME, &file_name, sizeof (file_name)))
terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
}
--
2.20.1

View File

@ -1,12 +1,14 @@
Name: gdbm
Version: 1.18.1
Release: 2
Release: 3
Epoch: 1
Summary: A library of database functions that work similar to the standard UNIX dbm
License: GPLv3+
URL: http://www.gnu.org/software/gdbm/
Source0: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
Patch0: Fix-gdbmtool-import-command.patch
BuildRequires: gcc libtool gettext readline-devel git
Provides: %{name}-libs
@ -97,6 +99,9 @@ fi
%{_infodir}/*.info*
%changelog
* Thu Nov 25 2021 yangchenguang <yangchenguang@uniontech.com> - 1.18.1-3
- Fix gdbmtool parm import error
* Fri Oct 29 2021 yanglongkang <yanglongkang@huawei.com> - 1.18.1-2
- The devel package dependency is added to the devel package to resolve the installation error