diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-07-08 11:28:53 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-07-08 14:12:34 +0300 |
commit | 4aef6b36f862e46723403bc6422ac47058a5ef19 (patch) | |
tree | fa7afe6ed8f1abf080fa764bda1bbc81e07f407b /src/gdbmstore.c | |
parent | 260102cf7f75db3c87d04a06eb8054853cacce97 (diff) | |
download | gdbm-4aef6b36f862e46723403bc6422ac47058a5ef19.tar.gz gdbm-4aef6b36f862e46723403bc6422ac47058a5ef19.tar.bz2 |
Fix error handling in gdbm_fetch, gdbm_firstkey, and gdbm_nextkey.
* src/gdbmfetch.c: Hanlde out of memory error.
* src/findkey.c: Set gdbm_errno to GDBM_ITEM_NOT_FOUND
if nothing was found.
* src/gdbmdelete.c: Don't set gdbm_errno after
_gdbm_findkey returns -1. It's been done already.
* src/gdbmexp.c (gdbm_export_to_file): Return -1 if
gdbm_fetch fails.
* src/gdbmseq.c (get_next_key): Set gdbm_errno to
GDBM_ITEM_NOT_FOUND if there's no next key.
Don't call _gdbm_fatal on out of memory condition.
(gdbm_nextkey): Set gdbm_errno to
GDBM_ITEM_NOT_FOUND if there's no next key.
* src/gdbmtool.c (fetch_handler)
(firstkey_handler,nextkey_handler): Check gdbm_errno.
* src/gdbmstore.c: Handle error return from _gdbm_findkey.
* tests/gtdump.c: Likewise.
* tests/gtfetch.c: Likewise.
* doc/gdbm.texi: Document changes.
* doc/gdbm.3: Likewise.
* configure.ac: Version 1.12.90
* NEWS: Update.
* .gitignore: Update.
Diffstat (limited to 'src/gdbmstore.c')
-rw-r--r-- | src/gdbmstore.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gdbmstore.c b/src/gdbmstore.c index 8c6064d..3cb7560 100644 --- a/src/gdbmstore.c +++ b/src/gdbmstore.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* gdbmstore.c - Add a new key/data pair to the database. */ | 1 | /* gdbmstore.c - Add a new key/data pair to the database. */ |
2 | 2 | ||
3 | /* This file is part of GDBM, the GNU data base manager. | 3 | /* This file is part of GDBM, the GNU data base manager. |
4 | Copyright (C) 1990, 1991, 1993, 2007, 2011, 2013 Free Software Foundation, | 4 | Copyright (C) 1990, 1991, 1993, 2007, 2011, 2013, |
5 | Inc. | 5 | 2016 Free Software Foundation, Inc. |
6 | 6 | ||
7 | GDBM is free software; you can redistribute it and/or modify | 7 | GDBM is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
@@ -99,7 +99,8 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags) | |||
99 | return 1; | 99 | return 1; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | else if (gdbm_errno != GDBM_ITEM_NOT_FOUND) | |
103 | return -1; | ||
103 | 104 | ||
104 | /* Get the file address for the new space. | 105 | /* Get the file address for the new space. |
105 | (Current bucket's free space is first place to look.) */ | 106 | (Current bucket's free space is first place to look.) */ |