[sheepdog-users] [PATCH stable-0.7] dog: revive verbose option

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jan 8 10:14:37 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>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 dog/vdi.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index 85def26..b7b79f8 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -556,14 +556,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;
 }
@@ -676,13 +676,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);
 	free(buf);
 	return ret;
-- 
1.7.10.4




More information about the sheepdog-users mailing list