Skip to content
Browse files

fuse: If guestfs_last_errno returns 0, don't return no error to FUSE …

…layer.

guestfs_last_errno (g) == 0 doesn't mean "no error".  It means the
errno was not captured.  In this case we have to substitute some sort
of errno, so choose EINVAL arbitrarily.
  • Loading branch information...
1 parent 533082e commit 28e34290ff0dc11e9c5d8b8a1e5992cd0cc941fb @rwmjones rwmjones committed Jan 21, 2013
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/fuse.c
View
13 src/fuse.c
@@ -72,7 +72,18 @@ gl_lock_define_initialized (static, mount_local_lock);
g->localmountpoint, __func__, ## __VA_ARGS__); \
}
-#define RETURN_ERRNO return -guestfs_last_errno (g)
+#define RETURN_ERRNO \
+ do { \
+ int ret_errno = guestfs_last_errno (g); \
+ \
+ /* 0 doesn't mean "no error". It means the errno was not \
+ * captured. Therefore we have to substitute an errno here. \
+ */ \
+ if (ret_errno == 0) \
+ ret_errno = EINVAL; \
+ \
+ return -ret_errno; \
+ } while (0)
static struct guestfs_xattr_list *
copy_xattr_list (const struct guestfs_xattr *first, size_t num)

0 comments on commit 28e3429

Please sign in to comment.
Something went wrong with that request. Please try again.