From: Sassan Panahinejad <sassan@sassan.me.uk>
To: qemu-devel@nongnu.org
Cc: Sassan Panahinejad <sassan@sassan.me.uk>
Subject: [Qemu-devel] [PATCH] Fix bug with virtio-9p xattr functions return values
Date: Thu, 28 Apr 2011 14:48:57 +0100 [thread overview]
Message-ID: <1303998537-18128-1-git-send-email-sassan@sassan.me.uk> (raw)
Several functions in virtio-9p-xattr.c are passing the return value of the associated host system call back to the client instead of errno.
Since this value is -1 for any error (which, when received in the guest app as errno, indicates "operation not permitted") it is causing guest applications to fail in cases where the operation is not supported by the host.
This causes a number of problems with dpkg and with install.
This patch fixes the bug and returns the correct value, which means that guest applications are able to handle the error correctly.
Signed-off-by: Sassan Panahinejad <sassan@sassan.me.uk>
---
hw/virtio-9p-xattr.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/hw/virtio-9p-xattr.c b/hw/virtio-9p-xattr.c
index 1aab081..fd6d892 100644
--- a/hw/virtio-9p-xattr.c
+++ b/hw/virtio-9p-xattr.c
@@ -32,9 +32,14 @@ static XattrOperations *get_xattr_operations(XattrOperations **h,
ssize_t v9fs_get_xattr(FsContext *ctx, const char *path,
const char *name, void *value, size_t size)
{
+ int ret;
XattrOperations *xops = get_xattr_operations(ctx->xops, name);
if (xops) {
- return xops->getxattr(ctx, path, name, value, size);
+ ret = xops->getxattr(ctx, path, name, value, size);
+ if (ret < 0) {
+ return -errno;
+ }
+ return ret;
}
errno = -EOPNOTSUPP;
return -1;
@@ -117,9 +122,14 @@ err_out:
int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,
void *value, size_t size, int flags)
{
+ int ret;
XattrOperations *xops = get_xattr_operations(ctx->xops, name);
if (xops) {
- return xops->setxattr(ctx, path, name, value, size, flags);
+ ret = xops->setxattr(ctx, path, name, value, size, flags);
+ if (ret < 0) {
+ return -errno;
+ }
+ return ret;
}
errno = -EOPNOTSUPP;
return -1;
@@ -129,9 +139,14 @@ int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,
int v9fs_remove_xattr(FsContext *ctx,
const char *path, const char *name)
{
+ int ret;
XattrOperations *xops = get_xattr_operations(ctx->xops, name);
if (xops) {
- return xops->removexattr(ctx, path, name);
+ ret = xops->removexattr(ctx, path, name);
+ if (ret < 0) {
+ return -errno;
+ }
+ return ret;
}
errno = -EOPNOTSUPP;
return -1;
--
1.7.0.4
next reply other threads:[~2011-04-28 13:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 13:48 Sassan Panahinejad [this message]
2011-05-02 22:41 ` [Qemu-devel] [PATCH] Fix bug with virtio-9p xattr functions return values Venkateswararao Jujjuri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1303998537-18128-1-git-send-email-sassan@sassan.me.uk \
--to=sassan@sassan.me.uk \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).