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

From: @yangchen_guang
Reviewed-by: @liuzhiqiang26
Signed-off-by: @liuzhiqiang26
This commit is contained in:
openeuler-ci-bot 2021-12-09 09:14:41 +00:00 committed by Gitee
commit 39cf2394f7
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From f3c7872fed5e0782438d186ac88c63035a637462 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Thu, 18 Nov 2021 12:22:59 +0200
Subject: Fix gdbmtool import command
* src/gdbmshell.c (import_handler): Fix option addressing (see
https://puszcza.gnu.org.ua/bugs/?535).
Fix freeing of the uninitialized variable.
---
src/gdbmshell.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/gdbmshell.c b/src/gdbmshell.c
index 08042ce..96b5844 100644
--- a/src/gdbmshell.c
+++ b/src/gdbmshell.c
@@ -661,7 +661,7 @@ err_printer (void *data GDBM_ARG_UNUSED, char const *fmt, ...)
fprintf (stderr, "\n");
}
-/* recover sumamry verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */
+/* recover summary verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */
static int
recover_handler (struct command_param *param, struct command_environ *cenv)
{
@@ -1585,7 +1585,7 @@ import_handler (struct command_param *param,
int rc = GDBMSHELL_OK;
char *file_name;
- 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;
@@ -1637,7 +1637,6 @@ import_handler (struct command_param *param,
return GDBMSHELL_GDBM_ERR;
}
- free (file_name);
if (gdbm_setopt (gdbm_file, GDBM_GETDBNAME, &file_name, sizeof (file_name)))
{
dberror ("%s", "GDBM_GETDBNAME");
--
cgit v1.2.1

View File

@ -1,12 +1,14 @@
Name: gdbm Name: gdbm
Version: 1.22 Version: 1.22
Release: 1 Release: 2
Epoch: 1 Epoch: 1
Summary: A library of database functions that work similar to the standard UNIX dbm Summary: A library of database functions that work similar to the standard UNIX dbm
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/gdbm/ URL: http://www.gnu.org/software/gdbm/
Source0: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz Source0: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
Patch0: Fix-gdbmtool-import-command.patch
BuildRequires: gcc libtool gettext readline-devel BuildRequires: gcc libtool gettext readline-devel
Provides: %{name}-libs Provides: %{name}-libs
@ -96,6 +98,9 @@ fi
%{_infodir}/*.info* %{_infodir}/*.info*
%changelog %changelog
* Thu Dec 09 2021 yangchenguang <yangchenguang@uniontech.com> - 1.22-2
- Fix gdbmtool parm import error
* Wed Nov 17 2021 Wenchao Hao <haowenchao@huawei.com> - 1.22-1 * Wed Nov 17 2021 Wenchao Hao <haowenchao@huawei.com> - 1.22-1
- Update to gdbm-1.22 - Update to gdbm-1.22