From: Fotis Xenakis <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

virtio-fs: add error check in fs

Ref https://github.com/cloudius-systems/osv/issues/1094

Signed-off-by: Fotis Xenakis <[email protected]>
Message-Id: 
<am0pr03mb62920b03a55c363d6778498ea6...@am0pr03mb6292.eurprd03.prod.outlook.com>

---
diff --git a/fs/virtiofs/virtiofs_vfsops.cc b/fs/virtiofs/virtiofs_vfsops.cc
--- a/fs/virtiofs/virtiofs_vfsops.cc
+++ b/fs/virtiofs/virtiofs_vfsops.cc
@@ -55,12 +55,15 @@ std::pair<size_t, int> 
fuse_req_send_and_receive_reply(virtio::fs* drv,
     req->output_args_size = output_args_size;
 
     assert(drv);
-    drv->make_request(*req);
+    int error = drv->make_request(*req);
+    if (error) {
+        return std::make_pair(0, error);
+    }
     req->wait();
 
     // return the length of the response's payload
     size_t len = req->out_header.len - sizeof(fuse_out_header);
-    int error = -req->out_header.error;
+    error = -req->out_header.error;
 
     return std::make_pair(len, error);
 }

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000008d2a4d05ac21a704%40google.com.

Reply via email to