summaryrefslogtreecommitdiffabout
path: root/src/gdbmstore.c
authorSergey Poznyakoff <gray@gnu.org.ua>2016-07-25 15:21:05 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-07-25 15:21:05 (GMT)
commit465e893bfa0cdfb8f260500599fc3af458047a76 (patch) (side-by-side diff)
tree66542ee72c48ab7b32590bcc9fa9e30d0d77d277 /src/gdbmstore.c
parent2cc71d6ea5bb991fc63caa08b06c6479a87d0b63 (diff)
downloadgdbm-465e893bfa0cdfb8f260500599fc3af458047a76.tar.gz
gdbm-465e893bfa0cdfb8f260500599fc3af458047a76.tar.bz2
Improve debugging and error tracing.
* src/gdbmdefs.h (GDBM_SET_ERRNO) (GDBM_SET_ERRNO2): New macros. * src/base64.c: Use new macros to set error state. * src/bucket.c: Likewise. * src/falloc.c: Likewise. * src/findkey.c: Likewise. * src/gdbm_load.c: Likewise. * src/gdbmdelete.c: Likewise. * src/gdbmdump.c: Likewise. * src/gdbmexp.c: Likewise. * src/gdbmfetch.c: Likewise. * src/gdbmimp.c: Likewise. * src/gdbmload.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmsetopt.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmtool.c: Fix preprocessor conditional.
Diffstat (limited to 'src/gdbmstore.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/gdbmstore.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gdbmstore.c b/src/gdbmstore.c
index 050b0a9..4cd7ad1 100644
--- a/src/gdbmstore.c
+++ b/src/gdbmstore.c
@@ -55,9 +55,8 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
/* First check to make sure this guy is a writer. */
if (dbf->read_write == GDBM_READER)
{
- GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
- "%s: can't store: not a writer", dbf->name);
- gdbm_set_errno (dbf, GDBM_READER_CANT_STORE, FALSE);
+ GDBM_SET_ERRNO2 (dbf, GDBM_READER_CANT_STORE, FALSE,
+ GDBM_DEBUG_STORE);
return -1;
}
@@ -65,9 +64,8 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
NULL dptr returned by a lookup procedure indicates an error. */
if ((key.dptr == NULL) || (content.dptr == NULL))
{
- GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
- "%s: can't store: invalid key or content", dbf->name);
- gdbm_set_errno (dbf, GDBM_ILLEGAL_DATA, FALSE);
+ GDBM_SET_ERRNO2 (dbf, GDBM_ILLEGAL_DATA, FALSE,
+ GDBM_DEBUG_STORE);
return -1;
}
@@ -103,9 +101,8 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
}
else
{
- GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
- "%s: cannot replace", dbf->name);
- gdbm_set_errno (dbf, GDBM_CANNOT_REPLACE, FALSE);
+ GDBM_SET_ERRNO2 (dbf, GDBM_CANNOT_REPLACE, FALSE,
+ GDBM_DEBUG_STORE);
return 1;
}
}
@@ -158,7 +155,7 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
{
GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
"%s: lseek: %s", dbf->name, strerror (errno));
- gdbm_set_errno (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
+ GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_STORE);
_gdbm_fatal (dbf, _("lseek error"));
return -1;
}

Return to:

Send suggestions and report system problems to the System administrator.