[sheepdog] [PATCH v2 5/5] collie: force snapshot id to be larger than zero

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Mar 11 08:07:11 CET 2013


The snapshot with id zero does not exist.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/vdi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/collie/vdi.c b/collie/vdi.c
index 501fa5b..78b81f5 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -2013,6 +2013,10 @@ static int vdi_parser(int ch, char *opt)
 			vdi_cmd_data.snapshot_id = 0;
 			pstrcpy(vdi_cmd_data.snapshot_tag,
 				sizeof(vdi_cmd_data.snapshot_tag), opt);
+		} else if (vdi_cmd_data.snapshot_id == 0) {
+			fprintf(stderr,
+				"The snapshot id must be larger than zero\n");
+			exit(EXIT_FAILURE);
 		}
 		break;
 	case 'x':
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list