[sheepdog] [PATCH] dog: fix a core dump by 'vdi lock force-unlock'

Liu Yuan namei.unix at gmail.com
Thu Aug 28 08:19:12 CEST 2014


force-unlock expect an argument so we need to set CMD_NEED_ARG for it otherwise
a core will be generated by

$ dog vdi lock force-unlock # without argument

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 dog/vdi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index 19da73e..2b6a5cb 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -2870,8 +2870,8 @@ static int lock_force_unlock(int argc, char **argv)
 
 static struct subcommand vdi_lock_cmd[] = {
 	{"list", NULL, NULL, "list locked VDIs", NULL, 0, lock_list},
-	{"force-unlock", "<vdiname>", NULL, "unlock locked VDI forcibly", NULL, 0,
-	 lock_force_unlock},
+	{"force-unlock", "<vdiname>", NULL, "unlock locked VDI forcibly", NULL,
+	 CMD_NEED_ARG, lock_force_unlock},
 	{NULL},
 };
 
-- 
1.9.1



More information about the sheepdog mailing list