gdbm: Update to 1.10.

Creates compat-gdbm, which contains gdbm-1.8.3.
This commit is contained in:
Michael Tremer 2012-10-02 16:39:32 +02:00
parent f633807474
commit 3191bb0de8
9 changed files with 545 additions and 10 deletions

View File

@ -0,0 +1,82 @@
###############################################################################
# IPFire.org - An Open Source Firewall Solution #
# Copyright (C) - IPFire Development Team <info@ipfire.org> #
###############################################################################
name = compat-gdbm
version = 1.8.3
release = 1
thisapp = gdbm-%{version}
groups = Development/Tools
url = http://www.gnu.org/software/gdbm/
license = GPLv2+
summary = The GDBM package contains the GNU Database Manager.
description
The GDBM package contains the GNU Database Manager. This is a disk file \
format database which stores key/data-pairs in single files. The actual \
data of any record being stored is indexed by a unique key, which can be \
retrieved in less time than if it was stored in a text file.
end
source_dl = http://ftp.gnu.org/gnu/gdbm/
build
requires
autoconf
automake
libtool
end
prepare_cmds
libtoolize --force --copy
aclocal
autoconf
# Don't use flock, because it doesn't work on NFS.
# Use fcntl instead.
echo "#undef HAVE_FLOCK" >> autoconf.h.in
end
PARALLELISMFLAGS = # Not supported.
install
make install install-compat \
prefix=%{BUILDROOT}%{prefix} \
libdir=%{BUILDROOT}%{libdir} \
includedir=%{BUILDROOT}%{includedir} \
mandir=%{BUILDROOT}%{mandir} \
infodir=%{BUILDROOT}%{infodir}
mkdir -pv %{BUILDROOT}%{includedir}/gdbm
ln -svf gdbm/gdbm.h %{BUILDROOT}%{includedir}/gdbm.h
# Remove all man pages provided by gdbm-devel.
rm -rfv %{BUILDROOT}%{mandir}/man3
end
end
packages
package %{name}
conflicts
gdbm <= %{version}
end
end
package %{name}-devel
template DEVEL
requires
compat-gdbm = %{thisver}
end
conflicts
gdbm-devel
end
end
package %{name}-debuginfo
template DEBUGINFO
end
end

View File

@ -0,0 +1,138 @@
diff -up gdbm-1.8.3/Makefile.in.fhs gdbm-1.8.3/Makefile.in
--- gdbm-1.8.3/Makefile.in.fhs 2002-10-08 18:09:12.000000000 +0200
+++ gdbm-1.8.3/Makefile.in 2010-03-10 15:41:01.516025096 +0100
@@ -1,7 +1,7 @@
#### Start of system configuration section. ####
srcdir = @srcdir@
-top_builddir = .
+top_builddir = @top_builddir@
VPATH = @srcdir@
CC = @CC@
@@ -14,17 +14,13 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-# File ownership and group
-BINOWN = bin
-BINGRP = bin
-
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
-DEFS =
+DEFS = @DEFS@
# Where the system [n]dbm routines are...
-LIBS = @LIBS@ -lc
+LIBS = @LIBS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
@@ -32,16 +28,17 @@ LDFLAGS = @LDFLAGS@
# Common prefix for installation directories
prefix = @prefix@
exec_prefix = @exec_prefix@
-binprefix = $(exec_prefix)
-manprefix = $(prefix)
+datarootdir = @datarootdir@
# Directory in which to put libgdbm.a.
libdir = @libdir@
# The include directory for gdbm.h and dbm.h.
includedir = @includedir@
+pkgincludedir = $(includedir)/gdbm
# Info and man directories.
infodir = @infodir@
-man3dir = @mandir@/man3
+mandir = @mandir@
+man3dir = $(mandir)/man3
manext = 3
#### End of system configuration section. ####
@@ -57,7 +54,7 @@ manext = 3
SHELL = /bin/sh
-PROGS = libgdbm.la testgdbm testdbm testndbm tndbm tdbm conv2gdbm
+PROGS = libgdbm.la testgdbm testdbm testndbm conv2gdbm
DBM_CF = dbminit.c delete.c fetch.c store.c seq.c close.c
@@ -127,26 +124,17 @@ all: libgdbm.la libgdbm_compat.la
progs: $(PROGS)
install: libgdbm.la gdbm.h gdbm.info
- $(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \
- $(INSTALL_ROOT)$(includedir) $(INSTALL_ROOT)$(man3dir) \
- $(INSTALL_ROOT)$(infodir)
- $(LIBTOOL) $(INSTALL) -c libgdbm.la $(INSTALL_ROOT)$(libdir)/libgdbm.la
- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) gdbm.h \
- $(INSTALL_ROOT)$(includedir)/gdbm.h
- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.3 \
- $(INSTALL_ROOT)$(man3dir)/gdbm.3
- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.info \
- $(INSTALL_ROOT)$(infodir)/gdbm.info
+ $(srcdir)/mkinstalldirs $(libdir) $(pkgincludedir) $(man3dir) $(infodir)
+ $(LIBTOOL) install install libgdbm.la $(libdir)/libgdbm.la
+ $(INSTALL_DATA) gdbm.h $(pkgincludedir)/gdbm.h
+ $(INSTALL_DATA) $(srcdir)/gdbm.3 $(man3dir)/gdbm.3
+ $(INSTALL_DATA) $(srcdir)/gdbm.info $(infodir)/gdbm.info
install-compat:
- $(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \
- $(INSTALL_ROOT)$(includedir)
- $(LIBTOOL) $(INSTALL) -c libgdbm_compat.la \
- $(INSTALL_ROOT)$(libdir)/libgdbm_compat.la
- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/dbm.h \
- $(INSTALL_ROOT)$(includedir)/dbm.h
- $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/ndbm.h \
- $(INSTALL_ROOT)$(includedir)/ndbm.h
+ $(srcdir)/mkinstalldirs $(libdir) $(pkgincludedir)
+ $(LIBTOOL) install install libgdbm_compat.la $(libdir)/libgdbm_compat.la
+ $(INSTALL_DATA) $(srcdir)/dbm.h $(pkgincludedir)/dbm.h
+ $(INSTALL_DATA) $(srcdir)/ndbm.h $(pkgincludedir)/ndbm.h
#libgdbm.a: $(OBJS) gdbm.h
# rm -f libgdbm.a
@@ -161,7 +149,7 @@ libgdbm.la: $(LOBJS) gdbm.h
libgdbm_compat.la: $(C_LOBJS) gdbm.h
rm -f libgdbm_compat.la
$(LIBTOOL) --mode=link $(CC) -o libgdbm_compat.la -rpath $(libdir) \
- -version-info $(SHLIB_VER) $(C_LOBJS)
+ -version-info $(SHLIB_VER) $(C_LOBJS) -lgdbm
gdbm.h: gdbm.proto gdbmerrno.h gdbm.proto2
rm -f gdbm.h
@@ -172,10 +160,10 @@ gdbm.h: gdbm.proto gdbmerrno.h gdbm.prot
chmod -w gdbm.h
testgdbm: testgdbm.o libgdbm.la @LIBOBJS@
- $(LIBTOOL) $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
+ $(LIBTOOL) link $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
testdbm: testdbm.o libgdbm.la libgdbm_compat.la
- $(LIBTOOL) $(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.la libgdbm_compat.la
+ $(LIBTOOL) link $(CC) $(LDFLAGS) -o testdbm testdbm.o $(LIBS) libgdbm_compat.la
tdbm: testdbm.o
$(CC) $(LDFLAGS) -o tdbm testdbm.o $(LIBS)
@@ -184,7 +172,7 @@ testndbm.o: testndbm.c
$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) -DGNU $(srcdir)/testndbm.c
testndbm: testndbm.o libgdbm.la libgdbm_compat.la
- $(LIBTOOL) $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.la libgdbm_compat.la
+ $(LIBTOOL) link $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm_compat.la
tndbm.o: testndbm.c
cp $(srcdir)/testndbm.c ./tndbm.c
@@ -195,7 +183,7 @@ tndbm: tndbm.o
$(CC) $(LDFLAGS) -o tndbm tndbm.o $(LIBS)
conv2gdbm: conv2gdbm.o libgdbm.la @LIBOBJS@
- $(LIBTOOL) $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm.la @LIBOBJS@
+ $(LIBTOOL) link $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm_compat.la @LIBOBJS@
lintgdbm:
lint $(DEFS) $(LFLAGS) $(DBM_CF) $(NDBM_CF) $(GDBM_CF) testgdbm.c

View File

@ -0,0 +1,12 @@
diff -up gdbm-1.8.3/gdbm.proto.filestruct gdbm-1.8.3/gdbm.proto
--- gdbm-1.8.3/gdbm.proto.filestruct 2011-01-13 09:54:03.004907454 +0100
+++ gdbm-1.8.3/gdbm.proto 2011-01-13 09:54:24.881714834 +0100
@@ -60,7 +60,7 @@ typedef struct {
/* The file information header. This is good enough for most applications. */
-typedef struct {int dummy[10];} *GDBM_FILE;
+typedef struct __GDBM_FILE_STRUC {int dummy[10];} *GDBM_FILE;
/* Determine if the C(++) compiler requires complete function prototype */
#ifndef __P

View File

@ -0,0 +1,94 @@
diff -up gdbm-1.8.3/dbmopen.c.dbmlock gdbm-1.8.3/dbmopen.c
--- gdbm-1.8.3/dbmopen.c.dbmlock 1999-05-19 02:16:05.000000000 +0200
+++ gdbm-1.8.3/dbmopen.c 2011-01-03 16:17:13.847173371 +0100
@@ -35,6 +35,28 @@
#include "gdbmerrno.h"
#include "extern.h"
+static int
+get_env_bool(env_var, def)
+ const char *env_var;
+ int def;
+{
+ const char *v = getenv(env_var);
+ if (!v)
+ return def;
+
+ if (!strcasecmp(v, "yes") ||
+ !strcasecmp(v, "true") ||
+ !strcasecmp(v, "on"))
+ return 1;
+
+ if (!strcasecmp(v, "no") ||
+ !strcasecmp(v, "false") ||
+ !strcasecmp(v, "off"))
+ return 0;
+
+ return !!atoi(v);
+}
+
/* Initialize ndbm system. FILE is a pointer to the file name. In
standard dbm, the database is found in files called FILE.pag and
FILE.dir. To make gdbm compatable with dbm using the dbminit call,
@@ -62,7 +84,7 @@ dbm_open (file, flags, mode)
char* dir_file; /* Used to construct "file.dir". */
struct stat dir_stat; /* Stat information for "file.dir". */
gdbm_file_info *temp_dbf; /* Temporary file pointer storage. */
-
+ int gdbm_mode = 0;
/* Prepare the correct names of "file.pag" and "file.dir". */
pag_file = (char *) malloc (strlen (file)+5);
@@ -77,26 +99,22 @@ dbm_open (file, flags, mode)
strcat (pag_file, ".pag");
strcpy (dir_file, file);
strcat (dir_file, ".dir");
-
+
+ if (!get_env_bool("NDBM_LOCK", 1))
+ gdbm_mode |= GDBM_NOLOCK;
/* Call the actual routine, saving the pointer to the file information. */
flags &= O_RDONLY | O_RDWR | O_CREAT | O_TRUNC;
if (flags == O_RDONLY)
- {
- temp_dbf = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL);
- }
+ gdbm_mode |= GDBM_READER;
else if (flags == (O_RDWR | O_CREAT))
- {
- temp_dbf = gdbm_open (pag_file, 0, GDBM_WRCREAT, mode, NULL);
- }
- else if ( (flags & O_TRUNC) == O_TRUNC)
- {
- temp_dbf = gdbm_open (pag_file, 0, GDBM_NEWDB, mode, NULL);
- }
+ gdbm_mode |= GDBM_WRCREAT;
+ else if ((flags & O_TRUNC) == O_TRUNC)
+ gdbm_mode |= GDBM_NEWDB;
else
- {
- temp_dbf = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL);
- }
+ gdbm_mode |= GDBM_WRITER;
+
+ temp_dbf = gdbm_open (pag_file, 0, gdbm_mode, mode, NULL);
/* Did we successfully open the file? */
if (temp_dbf == NULL)
diff -up gdbm-1.8.3/gdbm.3.dbmlock gdbm-1.8.3/gdbm.3
--- gdbm-1.8.3/gdbm.3.dbmlock 2011-01-03 15:59:15.684729255 +0100
+++ gdbm-1.8.3/gdbm.3 2011-01-03 16:17:49.957570637 +0100
@@ -543,7 +543,11 @@ you must link in the \fIgdbm_compat\fR l
.sp
gcc -o prog proc.c -lgdbm -lgdbm_compat
-.SH BUGS
+.SH "ENVIRONMENT VARIABLES"
+\fINDBM_LOCK\fR - When the NDBM interface is used, the database file
+is locked by default. Locking might degrade performance when used on a
+NFS share. This environment variable can be set to false to tell GDBM
+not to lock the database file.
.SH "SEE ALSO"
dbm, ndbm

View File

@ -0,0 +1,113 @@
05_handle-short-read.patch
diff -urNad a/bucket.c b/bucket.c
--- a/bucket.c 1999-05-19 01:16:05.000000000 +0100
+++ b/bucket.c 2006-04-24 03:18:01.000000000 +0100
@@ -31,7 +31,7 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-
+#include <errno.h>
/* Initializing a new hash buckets sets all bucket entries to -1 hash value. */
void
@@ -68,7 +68,8 @@
int dir_index;
{
off_t bucket_adr; /* The address of the correct hash bucket. */
- int num_bytes; /* The number of bytes read. */
+ int num_bytes = 0; /* The total number of bytes read. */
+ int bytes_read; /* Number of bytes read in this syscall */
off_t file_pos; /* The return address for lseek. */
register int index; /* Loop index. */
@@ -111,7 +112,12 @@
if (file_pos != bucket_adr)
_gdbm_fatal (dbf, "lseek error");
- num_bytes = read (dbf->desc, dbf->bucket, dbf->header->bucket_size);
+ do
+ {
+ bytes_read = read (dbf->desc, dbf->bucket+num_bytes, dbf->header->bucket_size-num_bytes);
+ if (bytes_read > 0) num_bytes += bytes_read;
+ }
+ while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < dbf->header->bucket_size);
if (num_bytes != dbf->header->bucket_size)
_gdbm_fatal (dbf, "read error");
}
diff -urNad a/falloc.c b/falloc.c
--- a/falloc.c 2006-04-24 03:17:54.000000000 +0100
+++ b/falloc.c 2006-04-24 03:18:01.000000000 +0100
@@ -31,7 +31,7 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-
+#include <errno.h>
/* The forward definitions for this file. See the functions for
the definition of the function. */
@@ -174,7 +174,8 @@
pop_avail_block (dbf)
gdbm_file_info *dbf;
{
- int num_bytes; /* For use with the read system call. */
+ int num_bytes = 0; /* For use with the read system call. */
+ int bytes_read; /* For use with the read system call. */
off_t file_pos; /* For use with the lseek system call. */
avail_elem new_el;
avail_block *new_blk;
@@ -199,7 +200,12 @@
/* Read the block. */
file_pos = lseek (dbf->desc, new_el.av_adr, L_SET);
if (file_pos != new_el.av_adr) _gdbm_fatal (dbf, "lseek error");
- num_bytes = read (dbf->desc, new_blk, new_el.av_size);
+ do
+ {
+ bytes_read = read (dbf->desc, new_blk+num_bytes, new_el.av_size-num_bytes);
+ if (bytes_read > 0) num_bytes += bytes_read;
+ }
+ while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < new_el.av_size);
if (num_bytes != new_el.av_size) _gdbm_fatal (dbf, "read error");
/* Add the elements from the new block to the header. */
diff -urNad a/findkey.c b/findkey.c
--- a/findkey.c 1999-05-19 01:16:06.000000000 +0100
+++ b/findkey.c 2006-04-24 03:18:01.000000000 +0100
@@ -31,6 +31,7 @@
#include "autoconf.h"
#include "gdbmdefs.h"
+#include <errno.h>
/* Read the data found in bucket entry ELEM_LOC in file DBF and
@@ -41,11 +42,12 @@
gdbm_file_info *dbf;
int elem_loc;
{
- int num_bytes; /* For seeking and reading. */
+ int num_bytes = 0; /* For seeking and reading. */
int key_size;
int data_size;
off_t file_pos;
data_cache_elem *data_ca;
+ int bytes_read;
/* Is it already in the cache? */
if (dbf->cache_entry->ca_data.elem_loc == elem_loc)
@@ -74,7 +76,12 @@
dbf->bucket->h_table[elem_loc].data_pointer, L_SET);
if (file_pos != dbf->bucket->h_table[elem_loc].data_pointer)
_gdbm_fatal (dbf, "lseek error");
- num_bytes = read (dbf->desc, data_ca->dptr, key_size+data_size);
+ do
+ {
+ bytes_read = read (dbf->desc, data_ca->dptr+num_bytes, key_size+data_size-num_bytes);
+ if (bytes_read > 0) num_bytes += bytes_read;
+ }
+ while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < key_size+data_size);
if (num_bytes != key_size+data_size) _gdbm_fatal (dbf, "read error");
return data_ca->dptr;

View File

@ -0,0 +1,44 @@
02_zero-headers.patch by Jeff Johnson <jbj@redhat.com> and Colin Watson <cjwatson@debian.org>
diff -urNad a/falloc.c b/falloc.c
--- a/falloc.c 2001-02-28 06:52:33.000000000 +0000
+++ b/falloc.c 2003-09-08 23:58:43.000000000 +0100
@@ -272,7 +272,7 @@
/* Split the header block. */
- temp = (avail_block *) malloc (av_size);
+ temp = (avail_block *) calloc (1, av_size);
if (temp == NULL) _gdbm_fatal (dbf, "malloc error");
/* Set the size to be correct AFTER the pop_avail_block. */
temp->size = dbf->header->avail.size;
diff -urNad a/gdbmopen.c b/gdbmopen.c
--- a/gdbmopen.c 2003-09-08 23:58:01.000000000 +0100
+++ b/gdbmopen.c 2003-09-08 23:58:43.000000000 +0100
@@ -212,7 +212,7 @@
file_block_size = block_size;
/* Get space for the file header. */
- dbf->header = (gdbm_file_header *) malloc (file_block_size);
+ dbf->header = (gdbm_file_header *) calloc (1, file_block_size);
if (dbf->header == NULL)
{
gdbm_close (dbf);
@@ -256,7 +256,7 @@
(dbf->header->block_size - sizeof (hash_bucket))
/ sizeof (bucket_element) + 1;
dbf->header->bucket_size = dbf->header->block_size;
- dbf->bucket = (hash_bucket *) malloc (dbf->header->bucket_size);
+ dbf->bucket = (hash_bucket *) calloc (1, dbf->header->bucket_size);
if (dbf->bucket == NULL)
{
gdbm_close (dbf);
@@ -420,7 +420,7 @@
for(index = 0; index < size; index++)
{
(dbf->bucket_cache[index]).ca_bucket
- = (hash_bucket *) malloc (dbf->header->bucket_size);
+ = (hash_bucket *) calloc (1, dbf->header->bucket_size);
if ((dbf->bucket_cache[index]).ca_bucket == NULL)
{
gdbm_errno = GDBM_MALLOC_ERROR;

View File

@ -4,12 +4,12 @@
###############################################################################
name = gdbm
version = 1.8.3
release = 2
version = 1.10
release = 1
groups = Development/Tools
url = http://www.gnu.org/software/gdbm/
license = GPL
license = GPLv3+
summary = The GDBM package contains the GNU Database Manager.
description
@ -19,17 +19,22 @@ description
retrieved in less time than if it was stored in a text file.
end
source_dl =
source_dl = http://ftp.gnu.org/gnu/gdbm/
build
prepare_cmds
sed -i Makefile.* \
-e "s/^BINOWN = .*/BINOWN = root/" \
-e "s/^BINGRP = .*/BINGRP = root/"
requires
gettext
libtool
end
install
make install install-compat INSTALL_ROOT=%{BUILDROOT}
configure_options += \
--enable-libgdbm-compat
install_cmds
mkdir -pv %{BUILDROOT}%{includedir}/gdbm
ln -svf ../gdbm.h %{BUILDROOT}%{includedir}/gdbm/gdbm.h
ln -svf ../ndbm.h %{BUILDROOT}%{includedir}/gdbm/ndbm.h
ln -svf ../dbm.h %{BUILDROOT}%{includedir}/gdbm/dbm.h
end
end

View File

@ -0,0 +1,14 @@
diff -up gdbm-1.10/NOTE-WARNING.fedora gdbm-1.10/NOTE-WARNING
--- gdbm-1.10/NOTE-WARNING.fedora 2011-11-14 17:43:41.267566501 +0100
+++ gdbm-1.10/NOTE-WARNING 2011-11-14 17:47:53.312549265 +0100
@@ -12,8 +12,8 @@ systems where it is not the default. `L
when a system uses 64bit file offsets. Gdbm has, of course, supported `large
files' on systems where it was the default for a very long time.
-On some systems, such as Solaris, this functionality is not enabled by
-default. Gdbm will now enable it. THIS MEANS THAT GDBM 1.9 MAY NOT BE
+On some systems this functionality is not enabled by default. To enable it,
+build rpm with option --with=largefile. THIS MEANS THAT GDBM 1.9 MAY NOT BE
ABLE TO ACCESS DATABASES CREATED BY PREVIOUS VERIONS ON THE SAME SYSTEM.
Running the `configure' script with the `--disable-largefile' flag should

View File

@ -0,0 +1,33 @@
diff -up gdbm-1.10/src/falloc.c.zeroheaders gdbm-1.10/src/falloc.c
--- gdbm-1.10/src/falloc.c.zeroheaders 2011-11-11 11:59:11.000000000 +0100
+++ gdbm-1.10/src/falloc.c 2011-11-14 17:34:32.487604027 +0100
@@ -255,7 +255,7 @@ push_avail_block (GDBM_FILE dbf)
/* Split the header block. */
- temp = (avail_block *) malloc (av_size);
+ temp = (avail_block *) calloc (1, av_size);
if (temp == NULL) _gdbm_fatal (dbf, _("malloc error"));
/* Set the size to be correct AFTER the pop_avail_block. */
temp->size = dbf->header->avail.size;
diff -up gdbm-1.10/src/gdbmopen.c.zeroheaders gdbm-1.10/src/gdbmopen.c
--- gdbm-1.10/src/gdbmopen.c.zeroheaders 2011-11-11 19:39:42.000000000 +0100
+++ gdbm-1.10/src/gdbmopen.c 2011-11-14 17:33:24.867608650 +0100
@@ -264,7 +264,7 @@ gdbm_open (const char *file, int block_s
(dbf->header->block_size - sizeof (hash_bucket))
/ sizeof (bucket_element) + 1;
dbf->header->bucket_size = dbf->header->block_size;
- dbf->bucket = (hash_bucket *) malloc (dbf->header->bucket_size);
+ dbf->bucket = (hash_bucket *) calloc (1, dbf->header->bucket_size);
if (dbf->bucket == NULL)
{
gdbm_close (dbf);
@@ -456,7 +456,7 @@ _gdbm_init_cache(GDBM_FILE dbf, size_t s
for(index = 0; index < size; index++)
{
(dbf->bucket_cache[index]).ca_bucket
- = (hash_bucket *) malloc (dbf->header->bucket_size);
+ = (hash_bucket *) calloc (1, dbf->header->bucket_size);
if ((dbf->bucket_cache[index]).ca_bucket == NULL)
{
gdbm_errno = GDBM_MALLOC_ERROR;