diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-11-09 18:03:49 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-11-09 19:51:09 +0000 |
commit | 2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47 (patch) | |
tree | a718347b5c6141743397b90fe6cf90116a7c8738 /edit | |
parent | b460d9f32eb527bc7aad4894a5f85c4e69366104 (diff) | |
download | libguestfs-2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47.tar.gz libguestfs-2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47.tar.xz libguestfs-2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47.zip |
tools: Modify existing tools to use guestfs_{push,pop}_error_handler.
This is a shorter and more convenient way to disable errors
temporarily across calls.
Diffstat (limited to 'edit')
-rw-r--r-- | edit/virt-edit.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/edit/virt-edit.c b/edit/virt-edit.c index db480255..c34f044d 100644 --- a/edit/virt-edit.c +++ b/edit/virt-edit.c @@ -536,16 +536,13 @@ copy_attributes (const char *src, const char *dest) * attributes too? */ if (has_linuxxattrs) { - guestfs_error_handler_cb old_error_cb; - void *old_error_data; - old_error_cb = guestfs_get_error_handler (g, &old_error_data); - guestfs_set_error_handler (g, NULL, NULL); + guestfs_push_error_handler (g, NULL, NULL); selinux_context = guestfs_getxattr (g, src, "security.selinux", &selinux_context_size); /* selinux_context could be NULL. This isn't an error. */ - guestfs_set_error_handler (g, old_error_cb, old_error_data); + guestfs_pop_error_handler (g); } /* Set the permissions (inc. sticky and set*id bits), UID, GID. */ @@ -578,15 +575,12 @@ feature_available (guestfs_h *g, const char *feature) /* If there's an error we should ignore it, so to do that we have to * temporarily replace the error handler with a null one. */ - guestfs_error_handler_cb old_error_cb; - void *old_error_data; - old_error_cb = guestfs_get_error_handler (g, &old_error_data); - guestfs_set_error_handler (g, NULL, NULL); + guestfs_push_error_handler (g, NULL, NULL); const char *groups[] = { feature, NULL }; int r = guestfs_available (g, (char * const *) groups); - guestfs_set_error_handler (g, old_error_cb, old_error_data); + guestfs_pop_error_handler (g); return r == 0 ? 1 : 0; } |