aboutsummaryrefslogtreecommitdiff
path: root/src/gdbmdump.c
AgeCommit message (Collapse)AuthorFiles
2018-08-31Various bugfixes.Sergey Poznyakoff1
* compat/dbmopen.c (ndbm_open_dir_file0): Ignore ENOENT. * src/falloc.c (push_avail_block): Free temporary storage no matter what return status. * src/gdbm.h.in (GDBM_FILE_TRUNCATE_ERROR): New error code. * src/gdbmdump.c (_gdbm_dump_ascii): Initialize rc. * src/gdbmerrno.c: Handle new error.code * src/gdbmload.c (gdbm_load_bdb_dump): Initialize rc * src/gdbmopen.c (_gdbm_ftruncate): New function. (gdbm_fd_open): Use _gdbm_ftruncate. Check its return. * src/gdbmseq.c (gdbm_firstkey): Initialize dsize * src/gdbmtool.c (command_generator): Check if cmd is NULL. (shouldn't happen, but anyways). * src/mmap.c (_gdbm_mapped_lseek): Check for vailidity of the 'whence' parameter. * src/systems.h (TRUNCATE): Remove macro. * src/util.c (vgetyn): Remove unnecessary assignment.
2018-08-12BugfixSergey Poznyakoff1
* src/gdbmdump.c (_gdbm_dump_ascii): Clear the GDBM_ITEM_NOT_FOUND error. * src/gdbmexp.c (gdbm_export_to_file): Likewise. * NEWS: Update.
2018-05-19Catch more errorsSergey Poznyakoff1
* src/gdbmdump.c (_gdbm_dump_ascii): Break on errors * src/gdbmopen.c (compute_directory_size): Remove unused argument. (validate_header): Catch dir_size and dir_bits mismatches. * src/mmap.c (_gdbm_mapped_lseek): Bail out on negative offsets. * tests/dump03.at: New test. * tests/dump04.at: New test. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Add new tests.
2018-05-19Improve error checkingSergey Poznyakoff1
* src/bucket.c (_gdbm_get_bucket): Improve validation. * src/fullio.c (_gdbm_full_read,_gdbm_full_write): Don't overwrite an already set error. * src/gdbm.h.in (GDBM_WRONG_OFF_T): Merge with GDBM_BAD_FILE_OFFSET. (GDBM_BAD_HEADER): New error code. * src/gdbmdump.c (_gdbm_dump_ascii): Check for database error code. * src/gdbmerrno.c (gdbm_errlist): Add GDBM_BAD_HEADER * src/gdbmopen.c (validate_header: Imporve logic. (_gdbm_init_cache): Initialize bucket_cache * src/gdbmseq.c (gdbm_firstkey): Check return value from _gdbm_get_bucket. * src/mmap.c (_gdbm_mapped_remap): Bail out if current position is bigger than file size.
2018-01-01Happy GNU YearSergey Poznyakoff1
2017-01-02Happy GNU YearSergey Poznyakoff1
2016-07-25Improve debugging and error tracing.Sergey Poznyakoff1
* 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.
2016-07-09Don't bail out on fatal errors, unless the user defines the fatal_err functionSergey Poznyakoff1
* src/bucket.c (_gdbm_get_bucket) (_gdbm_split_bucket, _gdbm_write_bucket): Return error code. All callers updated. * src/proto.h (_gdbm_get_bucket) (_gdbm_split_bucket, _gdbm_write_bucket): Update declarations * src/falloc.c (push_avail_block) (pop_avail_block): Return error code. All callers updated. * src/update.c (_gdbm_fatal): Exit only if the user defined fatal_err function. * src/gdbmerrno.c (gdbm_needs_recovery): New function. * src/gdbm.h.in (gdbm_needs_recovery): New proto. * compat/dbminit.c: Set gdbm_errno on fatal errors. * compat/dbmopen.c: Likewise. * src/findkey.c: Likewise. * src/gdbm_load.c: Likewise. * src/gdbmcount.c: Likewise. * src/gdbmdefs.h: Likewise. * src/gdbmdelete.c: Likewise. * src/gdbmdump.c: Likewise. * src/gdbmexists.c: Likewise. * src/gdbmexp.c: Likewise. * src/gdbmfetch.c: Likewise. * src/gdbmimp.c: Likewise. * src/gdbmload.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmreorg.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmsetopt.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmsync.c: Likewise. * src/mmap.c: Likewise.
2016-07-09All gdbm functions return immediately if the DB is in inconsistent sate ↵Sergey Poznyakoff1
(needs recovery). * src/gdbm.h.in (GDBM_NEED_RECOVERY): New error code. * src/gdbmdefs.h (GDBM_ASSERT_CONSISTENCY): New macro. * src/gdbmerrno.c: Update. * src/gdbmopen.c (gdbm_open): Initialize need_recovery and last_error. * src/gdbmcount.c (gdbm_count): Return immediately if the database needs recovery. * src/gdbmdelete.c (gdbm_delete): Likewise. * src/gdbmdump.c (gdbm_dump_to_file, gdbm_dump): Likewise. * src/gdbmexists.c (gdbm_exists): Likewise. * src/gdbmexp.c (gdbm_export_to_file): Likewise. * src/gdbmfetch.c (gdbm_fetch): Likewise. * src/gdbmimp.c (gdbm_import_from_file): Likewise. * src/gdbmreorg.c (gdbm_reorganize): Likewise. * src/gdbmseq.c (gdbm_firstkey): Likewise. * src/gdbmsetopt.c (gdbm_nextkey): Likewise. * src/gdbmstore.c (gdbm_store): Likewise. * src/gdbmsync.c (gdbm_sync): Likewise.
2016-07-09Per-database error state.Sergey Poznyakoff1
Last error code is stored in the database file structure as well as in the global gdbm_errno. Special functions are provided for retrieving and clearing the last error state. * src/gdbmdefs.h (gdbm_file_info): New member: last_error * src/gdbm.h.in (gdbm_last_errno, gdbm_set_errno) (gdbm_clear_error): New protos. * src/gdbmerrno.c (gdbm_last_errno, gdbm_set_errno) (gdbm_clear_error): New functions * NEWS: Update. * compat/dbminit.c: Use gdbm_set_errno to set error state. * compat/dbmopen.c: Likewise. * src/bucket.c: Likewise. * src/findkey.c: Likewise. * src/gdbm_load.c: Likewise. * src/gdbmcount.c: Likewise. * src/gdbmdelete.c: Likewise. * src/gdbmdump.c: Likewise. * src/gdbmexists.c: Likewise. * src/gdbmexp.c: Likewise. * src/gdbmfetch.c: Likewise. * src/gdbmimp.c: Likewise. * src/gdbmload.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmreorg.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmsetopt.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmsync.c: Likewise. * src/mmap.c: Likewise.
2013-05-08Improve testgdbm; install some more bugfixes.Sergey Poznyakoff1
* src/gdbmdefs.h: Fix typo in a comment. * src/gdbmdump.c (gdbm_dump_to_file): Improve error checking. * src/testgdbm.c: Improve interactive usage. (command) <minlen>: Rename to len. (command_tab): Initialize len. (set_minimal_abbreviations): Remove. (sort_commands): New function. (find_command): Print possible alternatives in case of ambiguous input. (main): Reset param.argc after freeing previous arguments. Continue silently if find_command returns NULL.
2011-11-13Implement new dump format. Add new utilities: gdbm_dump and gdbm_load.Sergey Poznyakoff1
* configure.ac (AC_CHECK_HEADERS): Don't check for files that must always be present. Check for getopt.h. (AC_CHECK_FUNCS): Add getopt_long * src/systems.h: Include useless #if's. * src/flatfile.c: Split into two files: * src/gdbmexp.c: ... this and ... * src/gdbmimp.c: .., this * src/mem.c: New file. * src/base64.c: New file. * src/gdbm_dump.c: New file. * src/gdbm_load.c: New file. * src/gdbmapp.h: New file. * src/gdbmdump.c: New file. * src/gdbmload.c: New file. * src/parseopt.c: New file. * src/progname.c: New file. * src/.cvsignore: Update. * src/Makefile.am (libgdbm_la_SOURCES): Add new files. (noinst_LIBRARIES): New variable. Build libgdbmapp.a. (libgdbmapp_a_SOURCES): New variable. (bin_PROGRAMS): Add gdbm_load and gdbm_dump (testgdbm_LDADD, gdbm_load_LDADD) (gdbm_dump_LDADD): Add ./libgdbmapp.a * src/gdbm.h.in: Include <stdio.h> (gdbm_export_to_file) (gdbm_import_from_file): New prototypes. (GDBM_DUMP_FMT_BINARY,GDBM_DUMP_FMT_ASCII): New constants. (gdbm_dump,gdbm_load) (gdbm_dump_to_file,gdbm_load_from_file): New prototypes. (GDBM_NO_DBNAME): New error code. (_GDBM_MAX_ERRNO): Update. * src/gdbmdefs.h (_GDBM_MAX_DUMP_LINE_LEN): New constant. * src/gdbmerrno.c (gdbm_errlist): Add entry for GDBM_NO_DBNAME. * src/proto.h (_gdbm_base64_encode,_gdbm_base64_decode) (_gdbm_load,_gdbm_dump): New prototypes. * src/testgdbm.c: Use gdbmapp interface for option parsing. * export/export.c: Include gdbmexp.c * export/.cvsignore: Update. * doc/gdbm.texinfo: Update.

Return to:

Send suggestions and report system problems to the System administrator.