[sheepdog] [PATCH 2/4] collie: compare return values correctly

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Mar 11 06:39:12 CET 2013


read_vdi_obj and do_vdi_delete return exit statuses, so we must
compare their return values with EXIT_SUCCESS.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/vdi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/collie/vdi.c b/collie/vdi.c
index 1bcc6f0..501fa5b 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -792,8 +792,8 @@ static int vdi_rollback(int argc, char **argv)
 	ret = read_vdi_obj(vdiname, vdi_cmd_data.snapshot_id,
 			   vdi_cmd_data.snapshot_tag, &base_vid, inode,
 			   SD_INODE_HEADER_SIZE);
-	if (ret < 0)
-		return EXIT_FAILURE;
+	if (ret != EXIT_SUCCESS)
+		return ret;
 
 	ret = do_vdi_delete(vdiname, 0, NULL);
 	if (ret != SD_RES_SUCCESS) {
@@ -1828,9 +1828,8 @@ static int vdi_restore(int argc, char **argv)
 	}
 
 	ret = do_vdi_delete(vdiname, 0, NULL);
-	if (ret != SD_RES_SUCCESS) {
+	if (ret != EXIT_SUCCESS) {
 		fprintf(stderr, "Failed to delete the current state\n");
-		ret = EXIT_FAILURE;
 		goto out;
 	}
 	need_current_recovery = true;
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list