diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-15 12:39:10 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-15 12:39:10 +0000 |
commit | af116bb7d7d5a53310e48d196ebe577b9a63f799 (patch) | |
tree | 904c07043b29bc3bcf9c2232276187c9fd1f16b4 /doc/gdbm.texinfo | |
parent | 4931e4393ebff15289ad282f3d3dd0fba4999986 (diff) | |
download | gdbm-af116bb7d7d5a53310e48d196ebe577b9a63f799.tar.gz gdbm-af116bb7d7d5a53310e48d196ebe577b9a63f799.tar.bz2 |
Return a meaningful error code if failed to restore file's metadata.
* src/gdbm.h.in (GDBM_ERR_FILE_OWNER)
(GDBM_ERR_FILE_MODE): New error codes.
(_GDBM_MAX_ERRNO): Update.
* src/gdbmerrno.c (gdbm_errlist): Add new error codes.
* src/gdbmload.c (_set_gdbm_meta_info): Set gdbm_errno and
return 1 in case of errors.
(_gdbm_load_file): Propagate the return value from
_set_gdbm_meta_info.
* src/gdbm_load.c (main): Handle mild error conditions.
* export/export.c (usage): Print the GDBM version the program is
linked with.
* doc/gdbm.texinfo: Document changes.
Diffstat (limited to 'doc/gdbm.texinfo')
-rw-r--r-- | doc/gdbm.texinfo | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/doc/gdbm.texinfo b/doc/gdbm.texinfo index 4dcdd76..1e51322 100644 --- a/doc/gdbm.texinfo +++ b/doc/gdbm.texinfo | |||
@@ -727,8 +727,10 @@ set @code{gdbm_errno} to @samp{GDBM_NO_DBNAME} and return | |||
727 | The @var{flag} has the same meaning as the @var{flag} argument | 727 | The @var{flag} has the same meaning as the @var{flag} argument |
728 | to the @code{gdbm_store} function (@pxref{Store}). | 728 | to the @code{gdbm_store} function (@pxref{Store}). |
729 | 729 | ||
730 | The function returns 0 upon successful completion or -1 on error. In | 730 | The function returns 0 upon successful completion or -1 on fatal |
731 | the latter case, @code{gdbm_errno} will be set to one of the | 731 | errors and 1 on mild (non-fatal) errors. |
732 | |||
733 | If a fatal error occurs, @code{gdbm_errno} will be set to one of the | ||
732 | following values: | 734 | following values: |
733 | 735 | ||
734 | @table @asis | 736 | @table @asis |
@@ -753,10 +755,28 @@ length specification. Application developers are advised to treat | |||
753 | this error equally as @samp{GDBM_ILLEGAL_DATA}. | 755 | this error equally as @samp{GDBM_ILLEGAL_DATA}. |
754 | @end table | 756 | @end table |
755 | 757 | ||
756 | If any error, excepting @var{GDBM_FILE_OPEN_ERROR}, occurs and the | 758 | Mild errors mean that the function was able to successfully load and |
757 | input file is in ASCII format, the number of line in which the error | 759 | restore the data, but was unable to change database file metadata |
758 | occurred will be stored in the location pointed to by the | 760 | afterwards. The table below lists possible values for @code{gdbm_errno} |
759 | @var{errline} parameter, unless it is @samp{NULL}. | 761 | in this case. To get more detail, inspect the system @code{errno} variable. |
762 | |||
763 | @table @asis | ||
764 | @kwindex GDBM_ERR_FILE_OWNER | ||
765 | @item GDBM_ERR_FILE_OWNER | ||
766 | The function was unable to restore database file owner. | ||
767 | |||
768 | @kwindex GDBM_ERR_FILE_MODE | ||
769 | @item GDBM_ERR_FILE_MODE | ||
770 | The function was unable to restore database file mode (permission bits). | ||
771 | @end table | ||
772 | |||
773 | If an error occurs while loading data from an input file in ASCII | ||
774 | format, the number of line in which the error occurred will be stored | ||
775 | in the location pointed to by the @var{errline} parameter, unless it | ||
776 | is @samp{NULL}. | ||
777 | |||
778 | If the line information is not available or applicable, @var{errline} | ||
779 | will be set to @samp{0}. | ||
760 | @end deftypefn | 780 | @end deftypefn |
761 | 781 | ||
762 | @deftypefn {gdbm interface} int gdbm_dump_to_file (GDBM_FILE @var{dbf}, @ | 782 | @deftypefn {gdbm interface} int gdbm_dump_to_file (GDBM_FILE @var{dbf}, @ |
@@ -1676,6 +1696,23 @@ Output database name is not specified. This error code is set by | |||
1676 | @code{gdbm_load} (@pxref{gdbm_load function,,gdbm_load}) if the first | 1696 | @code{gdbm_load} (@pxref{gdbm_load function,,gdbm_load}) if the first |
1677 | argument points to @samp{NULL} and the input file does not specify the | 1697 | argument points to @samp{NULL} and the input file does not specify the |
1678 | database name. | 1698 | database name. |
1699 | |||
1700 | @kwindex GDBM_ERR_FILE_OWNER | ||
1701 | @item GDBM_ERR_FILE_OWNER | ||
1702 | This error code is set by @code{gdbm_load} if it is unable to restore | ||
1703 | database file owner. It is a mild error condition, meaning that the | ||
1704 | data have been restored successfully, only changing the target file | ||
1705 | owner failed. Inspect the system @code{errno} variable to get a more | ||
1706 | detailed diagnostics. | ||
1707 | |||
1708 | @kwindex GDBM_ERR_FILE_MODE | ||
1709 | @item GDBM_ERR_FILE_MODE | ||
1710 | This error code is set by @code{gdbm_load} if it is unable to restore | ||
1711 | database file mode. It is a mild error condition, meaning that the data | ||
1712 | have been restored successfully, only changing the target file owner | ||
1713 | failed. Inspect the system @code{errno} variable to get a more | ||
1714 | detailed diagnostics. | ||
1715 | |||
1679 | @end table | 1716 | @end table |
1680 | 1717 | ||
1681 | @node Compatibility | 1718 | @node Compatibility |