[sheepdog] [PATCH] dog: revive verbose option

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jan 8 09:27:07 CET 2014


Some subcommands of "dog vdi" prints VID of newly created VDI when -v
(verbose) option is passed. But the option seems to be dead because of
an invalid error handling. This patch revives it.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 dog/vdi.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index b6c955c..8fd4664 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -647,14 +647,14 @@ static int vdi_create(int argc, char **argv)
 	vdi_show_progress(idx * SD_DATA_OBJ_SIZE, inode->vdi_size);
 	ret = EXIT_SUCCESS;
 
-	if (verbose) {
+out:
+	if (ret == EXIT_SUCCESS && verbose) {
 		if (raw_output)
 			printf("%x\n", vid);
 		else
 			printf("VDI ID of newly created VDI: %x\n", vid);
 	}
 
-out:
 	free(inode);
 	return ret;
 }
@@ -783,13 +783,14 @@ static int vdi_clone(int argc, char **argv)
 	vdi_show_progress(idx * SD_DATA_OBJ_SIZE, inode->vdi_size);
 	ret = EXIT_SUCCESS;
 
-	if (verbose) {
+out:
+	if (ret == EXIT_SUCCESS && verbose) {
 		if (raw_output)
 			printf("%x\n", new_vid);
 		else
 			printf("VDI ID of newly created clone: %x\n", new_vid);
 	}
-out:
+
 	free(inode);
 	if (new_inode)
 		free(new_inode);
-- 
1.7.10.4




More information about the sheepdog mailing list