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.
This commit is contained in:
Richard W.M. Jones
2013-01-21 14:30:32 +00:00
parent 533082e282
commit 28e34290ff

View File

@@ -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)