diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-05-13 18:19:22 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-05-13 18:19:22 +0100 |
commit | ebd2ff37a9eba9412456c42398f64a3cb107b79c (patch) | |
tree | dbc355d085fe0bc2c7754a7dccdd18821cda4f57 | |
parent | b8ad15031cacf910634b4f4f4632232949c4acd2 (diff) | |
download | hivex-ebd2ff37a9eba9412456c42398f64a3cb107b79c.tar.gz hivex-ebd2ff37a9eba9412456c42398f64a3cb107b79c.tar.xz hivex-ebd2ff37a9eba9412456c42398f64a3cb107b79c.zip |
hivex_root: Return errno == HIVEX_NO_KEY when root key is missing.
Previously we returned errno == ENOKEY. However this was an
unfortunate choice of error code since it is not defined in POSIX. As
a result it is missing on several platforms.
HIVEX_NO_KEY is defined as ENOKEY on platforms where this symbol
exists (thus maintaining backwards ABI compatibility), and defined as
another POSIX error code otherwise.
-rwxr-xr-x | generator/generator.ml | 9 | ||||
-rw-r--r-- | lib/hivex.c | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/generator/generator.ml b/generator/generator.ml index 9722312..117781a 100755 --- a/generator/generator.ml +++ b/generator/generator.ml @@ -701,6 +701,13 @@ typedef struct hive_h hive_h; typedef size_t hive_node_h; typedef size_t hive_value_h; +#include <errno.h> +#ifdef ENOKEY +# define HIVEX_NO_KEY ENOKEY +#else +# define HIVEX_NO_KEY ENOENT +#endif + /* Pre-defined types. */ enum hive_type { "; @@ -1273,7 +1280,7 @@ exhaustive): Corrupt or unsupported Registry file format. -=item ENOKEY +=item HIVEX_NO_KEY Missing root key. diff --git a/lib/hivex.c b/lib/hivex.c index 7715520..d042f4f 100644 --- a/lib/hivex.c +++ b/lib/hivex.c @@ -559,7 +559,7 @@ hivex_root (hive_h *h) { hive_node_h ret = h->rootoffs; if (!IS_VALID_BLOCK (h, ret)) { - errno = ENOKEY; + errno = HIVEX_NO_KEY; return 0; } return ret; |