Once a directory is plugged into the node, all data in it will be removed.
Therefore, it is better to print a warning message to user first for fear that
he or she specifies a wrong path.

Signed-off-by: Ruoyu <lian...@ucweb.com>
---
 dog/node.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dog/node.c b/dog/node.c
index 83ff541..95ef4a4 100644
--- a/dog/node.c
+++ b/dog/node.c
@@ -468,8 +468,16 @@ static int do_plug_unplug(char *disks, bool plug)
        return EXIT_SUCCESS;
 }
 
+#define MD_PLUG_PRINT                          \
+       "    __\n"                              \
+       "   ()'`;\n"                            \
+       "   /\\|`\n"                            \
+       "  /  |   Caution! The directories to be plugged will be purged.\n" \
+       "(/_)_|_  Are you sure you want to continue? [yes/no]: "
+
 static int md_plug(int argc, char **argv)
 {
+       confirm(MD_PLUG_PRINT);
        return do_plug_unplug(argv[optind], true);
 }
 
-- 
1.8.3.2


-- 
sheepdog mailing list
sheepdog@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to