[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] vchan-socket-proxy: Check xs_watch return value



commit 20b65c15a38d98f31f212925a3e5a733dce5b477
Author:     Jason Andryuk <jandryuk@xxxxxxxxx>
AuthorDate: Wed Jun 10 23:29:30 2020 -0400
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Fri Jun 26 11:59:46 2020 +0000

    vchan-socket-proxy: Check xs_watch return value
    
    Check the return value of xs_watch and error out on failure.
    
    This was found by Citrix's Coverity.
    
    Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Release-acked-by: Paul Durrant <paul@xxxxxxx>
---
 tools/libvchan/vchan-socket-proxy.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/libvchan/vchan-socket-proxy.c 
b/tools/libvchan/vchan-socket-proxy.c
index c6a83e4712..196f6016b9 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -232,8 +232,15 @@ static struct libxenvchan *connect_vchan(int domid, const 
char *path) {
         goto out;
     }
     /* wait for vchan server to create *path* */
-    xs_watch(xs, path, "path");
-    xs_watch(xs, "@releaseDomain", "release");
+    if (!xs_watch(xs, path, "path")) {
+        fprintf(stderr, "xs_watch(%s) failed.\n", path);
+        goto out;
+    }
+    if (!xs_watch(xs, "@releaseDomain", "release")) {
+        fprintf(stderr, "xs_watch(@releaseDomain failed.\n");
+        goto out;
+    }
+
     while ((watch_ret = xs_read_watch(xs, &watch_num))) {
         /* don't care about exact which fired the watch */
         free(watch_ret);
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.