[CRIU] [PATCH 1/2] lib: return -EBADE instead of -1

Ruslan Kuprieiev kupruser at gmail.com
Wed Dec 18 03:50:27 PST 2013


Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 lib/criu.c |  6 +++---
 lib/criu.h | 14 +++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/criu.c b/lib/criu.c
index 2c9e444..fc7a801 100644
--- a/lib/criu.c
+++ b/lib/criu.c
@@ -231,7 +231,7 @@ int criu_check(void)
 	if (ret)
 		goto exit;
 
-	ret = resp->success ? 0 : -1;
+	ret = resp->success ? 0 : -EBADE;
 
 exit:
 	if (resp)
@@ -263,7 +263,7 @@ int criu_dump(void)
 		else
 			ret = 0;
 	} else
-		ret = -1;
+		ret = -EBADE;
 
 exit:
 	if (resp)
@@ -292,7 +292,7 @@ int criu_restore(void)
 	if (resp->success)
 		ret = resp->restore->pid;
 	else
-		ret = -1;
+		ret = -EBADE;
 
 exit:
 	if (resp)
diff --git a/lib/criu.h b/lib/criu.h
index 6b44e0b..ec6ace4 100644
--- a/lib/criu.h
+++ b/lib/criu.h
@@ -45,20 +45,20 @@ void criu_set_log_file(char *log_file);
  *
  * Return value  errno                Description
  * ----------------------------------------------------------------------------
- * 0             0                    Success.
+ * 0             undefined            Success.
  *
- * >0            0                    Success(criu_restore() only).
+ * >0            undefined            Success(criu_restore() only).
  *
- * -1            0                    RPC has returned fail.
+ * -BADE         rpc error(0 for now) RPC has returned fail.
  *
- * -ECONNREFUSED from failed syscall  Unable to connect to CRIU.
+ * -ECONNREFUSED errno                Unable to connect to CRIU.
  *
- * -ECOMM        from failed syscall  Unable to send/recv msg to/from CRIU.
+ * -ECOMM        errno                Unable to send/recv msg to/from CRIU.
  *
- * -EINVAL       0                    CRIU doesn't support this type of request.
+ * -EINVAL       undefined            CRIU doesn't support this type of request.
  *                                    You should probably update CRIU.
  *
- * -EBADMSG      0                    Unexpected response from CRIU.
+ * -EBADMSG      undefined            Unexpected response from CRIU.
  *                                    You should probably update CRIU.
  */
 int criu_check(void);
-- 
1.8.3.2



More information about the CRIU mailing list