summaryrefslogtreecommitdiffstats
path: root/fuse
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-03 16:15:48 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-03 18:49:00 +0000
commit39052d270fcce991238fc5f9939677b5d6e31d15 (patch)
tree5aa9b1a2122439cc98cd3c6d8cfe97df278d436f /fuse
parent2066805a5d93b62beaf6653324715f0b62b06a05 (diff)
downloadlibguestfs-39052d270fcce991238fc5f9939677b5d6e31d15.tar.gz
libguestfs-39052d270fcce991238fc5f9939677b5d6e31d15.tar.xz
libguestfs-39052d270fcce991238fc5f9939677b5d6e31d15.zip
fuse: Use guestfs_last_errno instead of errno-reversal-hack.
Diffstat (limited to 'fuse')
-rw-r--r--fuse/guestmount.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
index 068f7ded..a32da6be 100644
--- a/fuse/guestmount.c
+++ b/fuse/guestmount.c
@@ -64,40 +64,10 @@ int inspector = 0;
const char *libvirt_uri;
int dir_cache_timeout = 60;
-/* This is ugly: guestfs errors are strings, FUSE wants -errno. We
- * have to do the conversion as best we can.
- */
-#define MAX_ERRNO 256
-
static int
error (void)
{
- int i;
- const char *err = guestfs_last_error (g);
-
- if (!err)
- return -EINVAL;
-
- if (verbose)
- fprintf (stderr, "%s\n", err);
-
- /* Add a few of our own ... */
-
- /* This indicates guestfsd died. Translate into a hard EIO error.
- * Arguably we could relaunch the guest if we hit this error.
- */
- if (strstr (err, "call launch before using this function"))
- return -EIO;
-
- /* See if it matches an errno string in the host. */
- for (i = 0; i < MAX_ERRNO; ++i) {
- const char *e = strerror (i);
- if (e && strstr (err, e) != NULL)
- return -i;
- }
-
- /* Too bad, return a generic error. */
- return -EINVAL;
+ return -guestfs_last_errno (g);
}
static struct guestfs_xattr_list *