diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-08-12 20:17:14 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-08-12 20:17:14 +0300 |
commit | 4e23fa7b90b56408d480ba8c7556b190757ea2c7 (patch) | |
tree | 7763d0dee3681c0a733a490feaf6dbdcf54e3f8d | |
parent | 6311c6b4d7ebe989447151a3e0f8b8ae0b5997d3 (diff) | |
download | gdbm-4e23fa7b90b56408d480ba8c7556b190757ea2c7.tar.gz gdbm-4e23fa7b90b56408d480ba8c7556b190757ea2c7.tar.bz2 |
Bugfix
* src/gdbmdump.c (_gdbm_dump_ascii): Clear the GDBM_ITEM_NOT_FOUND error.
* src/gdbmexp.c (gdbm_export_to_file): Likewise.
* NEWS: Update.
-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,2 +1,2 @@ | |||
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. |
@@ -13,2 +13,7 @@ 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 | ||
@@ -486,3 +491,3 @@ 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. " |
diff --git a/src/gdbmdump.c b/src/gdbmdump.c index daf6a43..2e6f5b0 100644 --- a/src/gdbmdump.c +++ b/src/gdbmdump.c | |||
@@ -114,5 +114,2 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp) | |||
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 |
@@ -121,2 +118,12 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp) | |||
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 | } |
@@ -124,3 +131,2 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp) | |||
124 | 131 | ||
125 | |||
126 | return rc ? -1 : 0; | 132 | 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) | |||
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; |