summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-03-19 16:32:10 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-03-20 09:11:29 +0000
commitc7dff02ccbb6bbe505c73df5d83bea8afdc188c3 (patch)
tree3b8af721a0c9c67b39c9f770db59273475f8f964
parentb8fc61bd9b87f9d55d37cd52f584f7706b2af078 (diff)
downloadlibguestfs-c7dff02ccbb6bbe505c73df5d83bea8afdc188c3.tar.gz
libguestfs-c7dff02ccbb6bbe505c73df5d83bea8afdc188c3.tar.xz
libguestfs-c7dff02ccbb6bbe505c73df5d83bea8afdc188c3.zip
inspection: Set last errno to ENOTSUP when inspection APIs are not available.
Previously there was no programmatic way to tell if inspection APIs were unavailable because they are not compiled in (because hivex isn't around). This contrasts with daemon APIs where the availability is covered by the guestfs_available API. Change the inspection APIs so that when they are not available, the last errno is set to ENOTSUP. (Note that ENOTSUP must be defined on all POSIX platforms). This allows programs to detect if they are using a version of libguestfs that was compiled without support for inspection, without having to parse error messages.
-rw-r--r--src/inspect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/inspect.c b/src/inspect.c
index 60c7dd44..117f57a7 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -542,7 +542,7 @@ guestfs__inspect_get_hostname (guestfs_h *g, const char *root)
/* XXX These functions should be in an optgroup. */
#define NOT_IMPL(r) \
- error (g, _("inspection API not available since this version of libguestfs was compiled without the hivex library")); \
+ guestfs_error_errno (g, ENOTSUP, _("inspection API not available since this version of libguestfs was compiled without the hivex library")); \
return r
char **