[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gdbm_store bug in gdbm 1.8.1?
From: |
Ian Miller |
Subject: |
gdbm_store bug in gdbm 1.8.1? |
Date: |
02 Feb 2003 01:19:18 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Hello.
Test program testgdbm is unable to store any key-value pairs at all;
failing with an "Item not inserted" message. This seems to me to be
because gdbm_store() uses an invalid test to check that storing is
allowed:
if (dbf->read_write != GDBM_WRITER)
<fail>
>From gdbmconst.h, these are its possible values:
#define GDBM_READER 0 /* READERS only. */
#define GDBM_WRITER 1 /* READERS and WRITERS. Can not create. */
#define GDBM_WRCREAT 2 /* If not found, create the db. */
#define GDBM_NEWDB 3 /* ALWAYS create a new db. (WRITER) */
testgdbm fails the test because by default it uses the GDBM_WRCREAT
flag value. Surely the last three are all valid writers (and the info
file agrees with this interpretation) and the gdbm_store() test ought
to be:
if (dbf->read_write == GDBM_READER)
<fail>
This, at least, allows me to run testgdbm and enter values into a
database file using its 's' command.
A patch in unified diff format follows.
I hope this is useful,
Ian
--- gdbmstore.c~ 1999-05-19 01:16:06.000000000 +0100
+++ gdbmstore.c 2003-02-02 01:00:40.000000000 +0000
@@ -65,7 +65,7 @@
/* First check to make sure this guy is a writer. */
- if (dbf->read_write != GDBM_WRITER)
+ if (dbf->read_write == GDBM_READER)
{
gdbm_errno = GDBM_READER_CANT_STORE;
return -1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gdbm_store bug in gdbm 1.8.1?,
Ian Miller <=