diff options
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | src/gdbmdump.c | 14 | ||||
-rw-r--r-- | src/gdbmexp.c | 7 |
3 files changed, 23 insertions, 7 deletions
@@ -1,19 +1,24 @@ | |||
1 | GNU dbm NEWS -- history of user-visible changes. 2018-07-30 | 1 | GNU dbm NEWS -- history of user-visible changes. 2018-08-12 |
2 | Copyright (C) 1990-2018 Free Software Foundation, Inc. | 2 | Copyright (C) 1990-2018 Free Software Foundation, Inc. |
3 | See the end of file for copying conditions. | 3 | See the end of file for copying conditions. |
4 | 4 | ||
5 | Please send gdbm bug reports to <bug-gdbm@gnu.org>. | 5 | Please send gdbm bug reports to <bug-gdbm@gnu.org>. |
6 | 6 | ||
7 | Version 1.17 - 2018-07-30 | 7 | Version 1.17 - 2018-07-30 |
8 | 8 | ||
9 | * int gdbm_close and gdbm_sync | 9 | * int gdbm_close and gdbm_sync |
10 | 10 | ||
11 | Both functions now return 0 on success. On error, they return -1 | 11 | Both functions now return 0 on success. On error, they return -1 |
12 | and set gdbm_errno and errno to the appropriate error codes. | 12 | and set gdbm_errno and errno to the appropriate error codes. |
13 | 13 | ||
14 | * Fix bug in gdbm_dump function | ||
15 | |||
16 | The function did not clear the GDBM_ITEM_NOT_FOUND error marker, which | ||
17 | is set upon its normal termination. | ||
18 | |||
14 | 19 | ||
15 | Version 1.16 - 2018-06-27 | 20 | Version 1.16 - 2018-06-27 |
16 | 21 | ||
17 | * Maintain sorting order of the available block list after coalescing | 22 | * Maintain sorting order of the available block list after coalescing |
18 | 23 | ||
19 | This is a very long-standing bug, dated back to the time when optional | 24 | This is a very long-standing bug, dated back to the time when optional |
@@ -481,11 +486,11 @@ Copyright (C) 1990-2017 Free Software Foundation, Inc. | |||
481 | under the above conditions, provided also that they | 486 | under the above conditions, provided also that they |
482 | carry prominent notices stating who last changed them. | 487 | carry prominent notices stating who last changed them. |
483 | 488 | ||
484 | Local variables: | 489 | Local variables: |
485 | mode: outline | 490 | mode: outline |
486 | paragraph-separate: "[ ]*$" | 491 | paragraph-separate: "[ ]*$" |
487 | eval: (add-hook 'write-file-hooks 'time-stamp) | 492 | eval: (add-hook 'write-file-functions 'time-stamp) |
488 | time-stamp-start: "changes. " | 493 | time-stamp-start: "changes. " |
489 | time-stamp-format: "%:y-%02m-%02d" | 494 | time-stamp-format: "%:y-%02m-%02d" |
490 | time-stamp-end: "\n" | 495 | time-stamp-end: "\n" |
491 | end: | 496 | end: |
diff --git a/src/gdbmdump.c b/src/gdbmdump.c index daf6a43..2e6f5b0 100644 --- a/src/gdbmdump.c +++ b/src/gdbmdump.c | |||
@@ -109,23 +109,29 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp) | |||
109 | free (key.dptr); | 109 | free (key.dptr); |
110 | free (data.dptr); | 110 | free (data.dptr); |
111 | key = nextkey; | 111 | key = nextkey; |
112 | count++; | 112 | count++; |
113 | } | 113 | } |
114 | 114 | ||
115 | if (rc == 0 && (rc = gdbm_last_errno (dbf)) == 0) | ||
116 | { | ||
117 | |||
118 | /* FIXME: Something like that won't hurt, although load does not | 115 | /* FIXME: Something like that won't hurt, although load does not |
119 | use it currently. */ | 116 | use it currently. */ |
120 | fprintf (fp, "#:count=%lu\n", (unsigned long) count); | 117 | fprintf (fp, "#:count=%lu\n", (unsigned long) count); |
121 | fprintf (fp, "# End of data\n"); | 118 | fprintf (fp, "# End of data\n"); |
119 | |||
120 | if (rc == 0) | ||
121 | { | ||
122 | rc = gdbm_last_errno (dbf); | ||
123 | if (rc == GDBM_ITEM_NOT_FOUND) | ||
124 | { | ||
125 | gdbm_clear_error (dbf); | ||
126 | gdbm_errno = GDBM_NO_ERROR; | ||
127 | rc = 0; | ||
128 | } | ||
122 | } | 129 | } |
123 | free (buffer); | 130 | free (buffer); |
124 | 131 | ||
125 | |||
126 | return rc ? -1 : 0; | 132 | return rc ? -1 : 0; |
127 | } | 133 | } |
128 | 134 | ||
129 | int | 135 | int |
130 | gdbm_dump_to_file (GDBM_FILE dbf, FILE *fp, int format) | 136 | gdbm_dump_to_file (GDBM_FILE dbf, FILE *fp, int format) |
131 | { | 137 | { |
diff --git a/src/gdbmexp.c b/src/gdbmexp.c index 25ad5b2..56a792a 100644 --- a/src/gdbmexp.c +++ b/src/gdbmexp.c | |||
@@ -80,13 +80,18 @@ gdbm_export_to_file (GDBM_FILE dbf, FILE *fp) | |||
80 | free (key.dptr); | 80 | free (key.dptr); |
81 | free (data.dptr); | 81 | free (data.dptr); |
82 | key = nextkey; | 82 | key = nextkey; |
83 | 83 | ||
84 | count++; | 84 | count++; |
85 | } | 85 | } |
86 | if (gdbm_errno != GDBM_ITEM_NOT_FOUND) | 86 | if (gdbm_last_errno (dbf) == GDBM_ITEM_NOT_FOUND) |
87 | { | ||
88 | gdbm_clear_error (dbf); | ||
89 | gdbm_errno = GDBM_NO_ERROR; | ||
90 | } | ||
91 | else | ||
87 | return -1; | 92 | return -1; |
88 | 93 | ||
89 | return count; | 94 | return count; |
90 | 95 | ||
91 | write_fail: | 96 | write_fail: |
92 | 97 | ||