aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/bucket.c4
-rw-r--r--src/falloc.c2
-rw-r--r--src/gdbmopen.c2
-rw-r--r--src/gdbmsetopt.c2
-rw-r--r--src/gdbmtool.c2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 0d2ca53..2710bf0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,13 +30,13 @@ noinst_HEADERS = \
EXTRA_DIST = gdbm.h.in gdbm.magic
BUILT_SOURCES = gdbm.h gram.h
gram.h: gram.c
# The libraries
-VI_CURRENT = 5
+VI_CURRENT = 6
VI_REVISION = 0
VI_AGE = 0
lib_LTLIBRARIES = libgdbm.la
libgdbm_la_LIBADD = @LTLIBINTL@
diff --git a/src/bucket.c b/src/bucket.c
index a3e8f4e..4b69bbe 100644
--- a/src/bucket.c
+++ b/src/bucket.c
@@ -26,13 +26,13 @@
/* Initializing a new hash buckets sets all bucket entries to -1 hash value. */
void
_gdbm_new_bucket (GDBM_FILE dbf, hash_bucket *bucket, int bits)
{
int index;
-
+
/* Initialize the avail block. */
bucket->av_count = 0;
/* Set the information fields first. */
bucket->bucket_bits = bits;
bucket->count = 0;
@@ -143,13 +143,13 @@ _gdbm_get_bucket (GDBM_FILE dbf, int dir_index)
}
/* Validate the bucket */
bucket = dbf->bucket_cache[lru].ca_bucket;
if (!(bucket->count >= 0
&& bucket->count <= dbf->header->bucket_elems
&& bucket->bucket_bits >= 0
- && bucket->bucket_bits <= GDBM_HASH_BITS))
+ && bucket->bucket_bits <= dbf->header->dir_bits))
{
GDBM_SET_ERRNO (dbf, GDBM_BAD_BUCKET, TRUE);
return -1;
}
/* Validate bucket_avail table */
if (gdbm_bucket_avail_table_validate (dbf, bucket))
diff --git a/src/falloc.c b/src/falloc.c
index 2f21ebe..6571d9b 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -289,13 +289,13 @@ push_avail_block (GDBM_FILE dbf)
&dbf->header->avail.count);
if (new_loc.av_size == 0)
new_loc = get_block (av_size, dbf);
av_adr = new_loc.av_adr;
/* Split the header block. */
- temp = malloc (av_size);
+ temp = calloc (1, av_size);
if (temp == NULL)
{
GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE);
_gdbm_fatal (dbf, _("malloc error"));
return -1;
}
diff --git a/src/gdbmopen.c b/src/gdbmopen.c
index 03cc4f4..677f1cf 100644
--- a/src/gdbmopen.c
+++ b/src/gdbmopen.c
@@ -151,13 +151,13 @@ validate_header (gdbm_file_header const *hdr, struct stat const *st)
if (!(hdr->dir_size >= dir_size))
return GDBM_BAD_HEADER;
compute_directory_size (hdr->dir_size, &dir_size, &dir_bits);
if (hdr->dir_bits != dir_bits)
return GDBM_BAD_HEADER;
- if (!(hdr->bucket_size > 0 && hdr->bucket_size > sizeof(hash_bucket)))
+ if (!(hdr->bucket_size > sizeof(hash_bucket)))
return GDBM_BAD_HEADER;
if (hdr->bucket_elems != bucket_element_count (hdr->bucket_size))
return GDBM_BAD_HEADER;
if (((hdr->block_size - sizeof (gdbm_file_header)) / sizeof(avail_elem) + 1)
diff --git a/src/gdbmsetopt.c b/src/gdbmsetopt.c
index f9face0..865f5a5 100644
--- a/src/gdbmsetopt.c
+++ b/src/gdbmsetopt.c
@@ -51,19 +51,19 @@ get_size (void *optval, int optlen, size_t *ret)
static int
setopt_gdbm_setcachesize (GDBM_FILE dbf, void *optval, int optlen)
{
size_t sz;
- /* Optval will point to the new size of the cache. */
if (dbf->bucket_cache != NULL)
{
GDBM_SET_ERRNO (dbf, GDBM_OPT_ALREADY_SET, FALSE);
return -1;
}
+ /* Optval will point to the new size of the cache. */
if (get_size (optval, optlen, &sz))
{
GDBM_SET_ERRNO (dbf, GDBM_OPT_ILLEGAL, FALSE);
return -1;
}
return _gdbm_init_cache (dbf, (sz > 9) ? sz : 10);
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index 6d56578..d0b2694 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -916,13 +916,13 @@ list_handler (struct handler_param *param)
{
datum nextkey = gdbm_nextkey (gdbm_file, key);
data = gdbm_fetch (gdbm_file, key);
if (!data.dptr)
{
- terror (_("cannot fetch data; the key was:"));
+ terror (_("%s; the key was:"), gdbm_db_strerror (gdbm_file));
datum_format (stderr, &key, dsdef[DS_KEY]);
}
else
{
datum_format (param->fp, &key, dsdef[DS_KEY]);
fputc (' ', param->fp);

Return to:

Send suggestions and report system problems to the System administrator.