[sheepdog] [PATCH v3 5/5] collie: don't allow empty path for 'node md' command

Liu Yuan namei.unix at gmail.com
Wed Apr 17 17:50:41 CEST 2013


From: Liu Yuan <tailai.ly at taobao.com>

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 collie/node.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/collie/node.c b/collie/node.c
index 64114db..d92c078 100644
--- a/collie/node.c
+++ b/collie/node.c
@@ -273,6 +273,11 @@ static int do_plug_unplug(char *disks, bool plug)
 	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
 	int ret;
 
+	if (!strlen(disks)) {
+		fprintf(stderr, "Empty path isn't allowed\n");
+		return EXIT_FAILURE;
+	}
+
 	if (plug)
 		sd_init_req(&hdr, SD_OP_MD_PLUG);
 	else
-- 
1.7.9.5




More information about the sheepdog mailing list