aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS9
-rw-r--r--src/gdbmdump.c20
-rw-r--r--src/gdbmexp.c7
3 files changed, 26 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index b883bc7..1ca9a32 100644
--- a/NEWS
+++ b/NEWS
@@ -1,2 +1,2 @@
-GNU dbm NEWS -- history of user-visible changes. 2018-07-30
+GNU dbm NEWS -- history of user-visible changes. 2018-08-12
Copyright (C) 1990-2018 Free Software Foundation, Inc.
@@ -13,2 +13,7 @@ and set gdbm_errno and errno to the appropriate error codes.
+* Fix bug in gdbm_dump function
+
+The function did not clear the GDBM_ITEM_NOT_FOUND error marker, which
+is set upon its normal termination.
+
@@ -486,3 +491,3 @@ mode: outline
paragraph-separate: "[ ]*$"
-eval: (add-hook 'write-file-hooks 'time-stamp)
+eval: (add-hook 'write-file-functions 'time-stamp)
time-stamp-start: "changes. "
diff --git a/src/gdbmdump.c b/src/gdbmdump.c
index daf6a43..2e6f5b0 100644
--- a/src/gdbmdump.c
+++ b/src/gdbmdump.c
@@ -114,9 +114,16 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp)
- if (rc == 0 && (rc = gdbm_last_errno (dbf)) == 0)
+ /* FIXME: Something like that won't hurt, although load does not
+ use it currently. */
+ fprintf (fp, "#:count=%lu\n", (unsigned long) count);
+ fprintf (fp, "# End of data\n");
+
+ if (rc == 0)
{
-
- /* FIXME: Something like that won't hurt, although load does not
- use it currently. */
- fprintf (fp, "#:count=%lu\n", (unsigned long) count);
- fprintf (fp, "# End of data\n");
+ rc = gdbm_last_errno (dbf);
+ if (rc == GDBM_ITEM_NOT_FOUND)
+ {
+ gdbm_clear_error (dbf);
+ gdbm_errno = GDBM_NO_ERROR;
+ rc = 0;
+ }
}
@@ -124,3 +131,2 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp)
-
return rc ? -1 : 0;
diff --git a/src/gdbmexp.c b/src/gdbmexp.c
index 25ad5b2..56a792a 100644
--- a/src/gdbmexp.c
+++ b/src/gdbmexp.c
@@ -85,3 +85,8 @@ gdbm_export_to_file (GDBM_FILE dbf, FILE *fp)
}
- if (gdbm_errno != GDBM_ITEM_NOT_FOUND)
+ if (gdbm_last_errno (dbf) == GDBM_ITEM_NOT_FOUND)
+ {
+ gdbm_clear_error (dbf);
+ gdbm_errno = GDBM_NO_ERROR;
+ }
+ else
return -1;

Return to:

Send suggestions and report system problems to the System administrator.