[Virtio-fs] [PATCH] virtiofsd: fix incorrect error handling in lo_do_lookup

Eric Ren renzhen at linux.alibaba.com
Tue Jun 11 13:44:40 UTC 2019


Signed-off-by: Eric Ren <renzhen at linux.alibaba.com>
---
 contrib/virtiofsd/passthrough_ll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
index 574e209d95..78716c8aca 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -670,7 +670,6 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
 		close(newfd);
 		newfd = -1;
 	} else {
-		saverr = ENOMEM;
 		inode = calloc(1, sizeof(struct lo_inode));
 		if (!inode)
 			goto out_err;
@@ -691,7 +690,9 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
 	res = fstatat(inode->fd, "", &e->attr,
 		      AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW);
 	if (res == -1) {
+		saverr = errno;
 		unref_inode(lo, inode, 1);
+		errno = saverr;
 		goto out_err;
 	}
 
-- 
2.17.2 (Apple Git-113)




More information about the Virtio-fs mailing list