[Libguestfs] [PATCH 3/3] hivex: Replace non-portable ENOKEY constant

Richard W.M. Jones rjones at redhat.com
Fri May 13 09:34:40 UTC 2011


On Fri, May 13, 2011 at 08:37:57AM +0200, Hilko Bengen wrote:
> I believe that "Required key not available" refers to a cryptographic
> key which makes no sense here.
> 
> hivex_root() checks if the root offset field points to an invalid
> position in the hive file and fails if this is not the case. I think
> "Bad address" is a good match.
> ---
>  lib/hivex.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/hivex.c b/lib/hivex.c
> index 7715520..e730547 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 = EFAULT;
>      return 0;
>    }
>    return ret;
> -- 
> 1.7.5.1

Unfortunately this is documented in the API and therefore can't
be changed.

A bigger problem is that some platforms lack ENOKEY (it's not defined
by POSIX).  I think Mac OS X was one.  However that's a separate
problem for those platforms.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list