[sheepdog] [PATCH] dog: allow snapshot tags which begin with decimal number

Liu Yuan namei.unix at gmail.com
Fri Feb 21 06:30:17 CET 2014


On Fri, Feb 21, 2014 at 12:16:50PM +0900, Hitoshi Mitake wrote:
> Current dog command doesn't accept snapshot tags which begin with
> decimal number, e.g. 123abc. This behavior comes from invalid usage of
> strtol(). This patch fixes this problem.
> 
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>  dog/vdi.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> v2: also updates "-F" option
> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 0b2d21b..9f8293e 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -2480,7 +2480,7 @@ static int vdi_parser(int ch, const char *opt)
>  		break;
>  	case 's':
>  		vdi_cmd_data.snapshot_id = strtol(opt, &p, 10);
> -		if (opt == p) {
> +		if (opt == p || *p != '\0') {
>  			vdi_cmd_data.snapshot_id = 0;
>  			pstrcpy(vdi_cmd_data.snapshot_tag,
>  				sizeof(vdi_cmd_data.snapshot_tag), opt);
> @@ -2515,7 +2515,7 @@ static int vdi_parser(int ch, const char *opt)
>  		break;
>  	case 'F':
>  		vdi_cmd_data.from_snapshot_id = strtol(opt, &p, 10);
> -		if (opt == p) {
> +		if (opt == p || *p != '\0') {
>  			vdi_cmd_data.from_snapshot_id = 0;
>  			pstrcpy(vdi_cmd_data.from_snapshot_tag,
>  				sizeof(vdi_cmd_data.from_snapshot_tag), opt);
> -- 
> 1.7.10.4
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

Applied thanks

Yuan



More information about the sheepdog mailing list