tools/xsplice: corrently use errno
authorRoger Pau Monne <roger.pau@citrix.com>
Tue, 3 May 2016 10:55:06 +0000 (12:55 +0200)
committerWei Liu <wei.liu2@citrix.com>
Wed, 4 May 2016 15:31:04 +0000 (16:31 +0100)
Some error paths incorrectly used rc instead of errno.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
tools/misc/xen-xsplice.c

index b3bf04843d0d36ddf9c01e9a4fbbe2cb56aa8c4b..4b23de6009f26d7edff9ac1c19d9213b98494304 100644 (file)
@@ -272,8 +272,8 @@ int action_func(int argc, char *argv[], unsigned int idx)
     rc = xc_xsplice_get(xch, name, &status);
     if ( rc )
     {
-        fprintf(stderr, "%s failed to get status (rc=%d, %s)!\n",
-                name, -rc, strerror(-rc));
+        fprintf(stderr, "%s failed to get status %d(%s)!\n",
+                name, errno, strerror(errno));
         return -1;
     }
     if ( status.rc == -EAGAIN )
@@ -295,7 +295,8 @@ int action_func(int argc, char *argv[], unsigned int idx)
         rc = action_options[idx].function(xch, name, 0);
         if ( rc )
         {
-            fprintf(stderr, "%s failed with %d(%s)\n", name, -rc, strerror(-rc));
+            fprintf(stderr, "%s failed with %d(%s)\n", name, errno,
+                    strerror(errno));
             return -1;
         }
     }